結果

問題 No.1708 Quality of Contest
ユーザー shimatshimat
提出日時 2021-10-26 19:49:07
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 395 bytes
コンパイル時間 98 ms
コンパイル使用メモリ 7,552 KB
実行使用メモリ 51,752 KB
最終ジャッジ日時 2024-04-15 18:57:54
合計ジャッジ時間 15,091 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 81 ms
12,416 KB
testcase_01 AC 89 ms
12,288 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 80 ms
12,288 KB
testcase_09 AC 695 ms
51,752 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 714 ms
47,324 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.rb:8: warning: assigned but unused variable - ab
Syntax OK

ソースコード

diff #

require 'set'

N, M, X = gets.split.map(&:to_i)
AB = N.times.map { gets.split.map(&:to_i) }
K = gets.to_i
C = gets.split.map(&:to_i)

ab = AB.sort_by{|ab| -ab[0]}

used = Set.new
ans = []
AB.each do |n|
  if used.add?(n[1])
    ans << n[0] + X
  else
    ans << n[0]
  end
end

ans.sort_by!{|x| -x}

ans2 = [0]
now = 0
ans.each do |x|
  now += x
  ans2 << now
end

p K.times.sum{|k| ans2[C[k]]}
0