結果

問題 No.1708 Quality of Contest
ユーザー とりゐとりゐ
提出日時 2022-05-28 16:48:57
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 420 ms / 2,000 ms
コード長 441 bytes
コンパイル時間 200 ms
コンパイル使用メモリ 81,796 KB
実行使用メモリ 133,600 KB
最終ジャッジ日時 2023-10-20 23:24:24
合計ジャッジ時間 11,458 ms
ジャッジサーバーID
(参考情報)
judge12 / judge10
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
53,344 KB
testcase_01 AC 37 ms
53,344 KB
testcase_02 AC 37 ms
53,344 KB
testcase_03 AC 82 ms
76,328 KB
testcase_04 AC 84 ms
76,440 KB
testcase_05 AC 85 ms
76,328 KB
testcase_06 AC 77 ms
74,256 KB
testcase_07 AC 83 ms
76,464 KB
testcase_08 AC 37 ms
53,344 KB
testcase_09 AC 355 ms
132,368 KB
testcase_10 AC 272 ms
121,960 KB
testcase_11 AC 372 ms
114,416 KB
testcase_12 AC 386 ms
119,688 KB
testcase_13 AC 351 ms
125,240 KB
testcase_14 AC 397 ms
121,952 KB
testcase_15 AC 420 ms
133,600 KB
testcase_16 AC 411 ms
130,628 KB
testcase_17 AC 386 ms
118,676 KB
testcase_18 AC 394 ms
128,500 KB
testcase_19 AC 400 ms
120,776 KB
testcase_20 AC 404 ms
122,204 KB
testcase_21 AC 387 ms
123,348 KB
testcase_22 AC 397 ms
123,560 KB
testcase_23 AC 402 ms
126,292 KB
testcase_24 AC 276 ms
127,916 KB
testcase_25 AC 277 ms
127,268 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,m,x=map(int,input().split())
genre=[[] for i in range(m+1)]
for _ in range(n):
  a,b=map(int,input().split())
  genre[b].append(a)

c=[]
for i in range(m+1):
  if genre[i]:
    genre[i].sort(reverse=True)
    c.append(genre[i][0]+x)
    for j in genre[i][1:]:
      c.append(j)

c.sort(reverse=True)
cum=[0]*(n+1)
for i in range(n):
  cum[i+1]=cum[i]+c[i]

ans=0
k=input()
for i in list(map(int,input().split())):
  ans+=cum[i]

print(ans)
0