結果

問題 No.1708 Quality of Contest
ユーザー 小野寺健小野寺健
提出日時 2021-10-30 18:08:59
言語 Ruby
(3.3.0)
結果
AC  
実行時間 845 ms / 2,000 ms
コード長 402 bytes
コンパイル時間 67 ms
コンパイル使用メモリ 7,552 KB
実行使用メモリ 47,388 KB
最終ジャッジ日時 2024-04-16 16:25:59
合計ジャッジ時間 15,245 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 93 ms
12,160 KB
testcase_01 AC 90 ms
12,288 KB
testcase_02 AC 89 ms
12,288 KB
testcase_03 AC 100 ms
12,288 KB
testcase_04 AC 102 ms
12,544 KB
testcase_05 AC 101 ms
12,544 KB
testcase_06 AC 103 ms
12,544 KB
testcase_07 AC 100 ms
12,416 KB
testcase_08 AC 91 ms
12,288 KB
testcase_09 AC 806 ms
47,388 KB
testcase_10 AC 535 ms
30,720 KB
testcase_11 AC 755 ms
35,584 KB
testcase_12 AC 790 ms
38,144 KB
testcase_13 AC 691 ms
34,176 KB
testcase_14 AC 812 ms
38,784 KB
testcase_15 AC 842 ms
41,088 KB
testcase_16 AC 845 ms
40,960 KB
testcase_17 AC 747 ms
37,760 KB
testcase_18 AC 748 ms
37,632 KB
testcase_19 AC 799 ms
39,808 KB
testcase_20 AC 740 ms
37,504 KB
testcase_21 AC 830 ms
39,296 KB
testcase_22 AC 793 ms
39,424 KB
testcase_23 AC 829 ms
40,960 KB
testcase_24 AC 567 ms
30,848 KB
testcase_25 AC 561 ms
30,848 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.rb:13: warning: assigned but unused variable - k
Syntax OK

ソースコード

diff #

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
0