結果

問題 No.1708 Quality of Contest
ユーザー 小野寺健
提出日時 2021-10-30 17:45:27
言語 Ruby
(3.4.1)
結果
TLE  
実行時間 -
コード長 416 bytes
コンパイル時間 372 ms
コンパイル使用メモリ 7,552 KB
実行使用メモリ 133,708 KB
最終ジャッジ日時 2024-10-07 13:48:12
合計ジャッジ時間 5,469 ms
ジャッジサーバーID
(参考情報)
judge4 / 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|
	i = v.each_with_index.max[1]
	v[i] += X
	list += v
}

list.sort!

cnt = [0]

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

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