結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 89 ms
17,792 KB
testcase_01 AC 93 ms
12,416 KB
testcase_02 AC 89 ms
12,288 KB
testcase_03 AC 124 ms
38,016 KB
testcase_04 AC 134 ms
43,264 KB
testcase_05 AC 115 ms
30,592 KB
testcase_06 AC 113 ms
28,800 KB
testcase_07 AC 115 ms
34,816 KB
testcase_08 AC 88 ms
12,416 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|
	v.sort!.reverse!
	v[0] += 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