結果

問題 No.1708 Quality of Contest
ユーザー 小野寺健小野寺健
提出日時 2021-10-30 17:40:16
言語 Ruby
(3.3.0)
結果
TLE  
実行時間 -
コード長 425 bytes
コンパイル時間 109 ms
コンパイル使用メモリ 7,680 KB
実行使用メモリ 128,108 KB
最終ジャッジ日時 2024-04-16 16:25:17
合計ジャッジ時間 5,234 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 94 ms
17,920 KB
testcase_01 AC 92 ms
12,160 KB
testcase_02 AC 86 ms
12,160 KB
testcase_03 AC 120 ms
30,976 KB
testcase_04 AC 129 ms
36,608 KB
testcase_05 AC 124 ms
35,200 KB
testcase_06 AC 117 ms
29,184 KB
testcase_07 AC 115 ms
30,720 KB
testcase_08 AC 87 ms
12,288 KB
testcase_09 TLE -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.rb:10: warning: assigned but unused variable - k
Syntax OK

ソースコード

diff #

N, M, X = gets.split(" ").map{|s| s.to_i}

A = Hash.new {|hash, key| hash[key] = Array.new}

N.times {
	a, b = gets.split(" ").map{|s| s.to_i}
	A[b] << a
}

k = gets.to_i
c = gets.split(" ").map{|s| s.to_i}

list = []
A.values.each {|v|
	i = v.each_with_index.max[1]
	v[i] += X
	list += v
}

list.sort!.reverse!

cnt = [0]

0.upto(c.max-1) {|i|
	cnt << cnt[-1] + list[i]
}

total = 0
c.each {|i|
	total += cnt[i]
}
puts total
0