結果

問題 No.1708 Quality of Contest
ユーザー 小野寺健
提出日時 2021-10-30 17:34:18
言語 Ruby
(3.4.1)
結果
TLE  
実行時間 -
コード長 413 bytes
コンパイル時間 315 ms
コンパイル使用メモリ 7,424 KB
実行使用メモリ 116,780 KB
最終ジャッジ日時 2024-10-07 13:47:48
合計ジャッジ時間 5,399 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 6 TLE * 1 -- * 16
権限があれば一括ダウンロードができます
コンパイルメッセージ
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