結果

問題 No.1708 Quality of Contest
ユーザー 👑 KazunKazun
提出日時 2021-10-15 21:59:38
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 340 ms / 2,000 ms
コード長 457 bytes
コンパイル時間 280 ms
コンパイル使用メモリ 81,852 KB
実行使用メモリ 130,992 KB
最終ジャッジ日時 2023-10-17 20:17:26
合計ジャッジ時間 7,120 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
53,356 KB
testcase_01 AC 38 ms
53,356 KB
testcase_02 AC 37 ms
53,356 KB
testcase_03 AC 59 ms
68,484 KB
testcase_04 AC 58 ms
68,484 KB
testcase_05 AC 60 ms
68,500 KB
testcase_06 AC 59 ms
68,496 KB
testcase_07 AC 57 ms
68,496 KB
testcase_08 AC 37 ms
53,356 KB
testcase_09 AC 296 ms
127,076 KB
testcase_10 AC 213 ms
115,432 KB
testcase_11 AC 292 ms
118,972 KB
testcase_12 AC 297 ms
123,096 KB
testcase_13 AC 266 ms
114,812 KB
testcase_14 AC 304 ms
126,276 KB
testcase_15 AC 338 ms
125,720 KB
testcase_16 AC 340 ms
127,220 KB
testcase_17 AC 300 ms
122,008 KB
testcase_18 AC 301 ms
124,396 KB
testcase_19 AC 309 ms
129,024 KB
testcase_20 AC 296 ms
121,420 KB
testcase_21 AC 317 ms
130,992 KB
testcase_22 AC 300 ms
126,180 KB
testcase_23 AC 330 ms
127,776 KB
testcase_24 AC 210 ms
113,932 KB
testcase_25 AC 207 ms
113,848 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input=sys.stdin.readline

N,M,X=map(int,input().split())

Q=[[] for _ in range(M+1)]
for _ in range(N):
    a,b=map(int,input().split())
    Q[b].append(a)

R=[]
for q in Q:
    q.sort(reverse=True)

    if q:
        q[0]+=X
    R+=q
R.sort(reverse=True)

K=int(input())
C=list(map(int,input().split()))

D=[0]*(N+1)
for c in C:
    D[c]+=1

for i in range(N-1,-1,-1):
    D[i]+=D[i+1]

Ans=0
for i in range(N):
    Ans+=D[i+1]*R[i]

print(Ans)
0