結果
| 問題 |
No.1708 Quality of Contest
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-10-30 18:08:59 |
| 言語 | Ruby (3.4.1) |
| 結果 |
AC
|
| 実行時間 | 826 ms / 2,000 ms |
| コード長 | 402 bytes |
| コンパイル時間 | 131 ms |
| コンパイル使用メモリ | 7,552 KB |
| 実行使用メモリ | 47,396 KB |
| 最終ジャッジ日時 | 2024-10-07 13:49:25 |
| 合計ジャッジ時間 | 15,354 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 23 |
コンパイルメッセージ
Main.rb:13: warning: assigned but unused variable - k Syntax OK
ソースコード
N, M, X = gets.split(" ").map{|s| s.to_i}
A = []
Max = Hash.new([-Float::INFINITY, -1])
N.times {
a, b = gets.split(" ").map{|s| s.to_i}
A << a
Max[b] = [a, A.length-1] if a > Max[b][0]
}
k = gets.to_i
c = gets.split(" ").map{|s| s.to_i}
Max.values.each {|a, i|
A[i] += X
}
A.sort!
cnt = [0]
1.upto(c.max) {|i|
cnt << cnt[-1] + A[N-i]
}
total = 0
c.each {|i|
total += cnt[i]
}
puts total