結果

問題 No.1708 Quality of Contest
ユーザー lloyzlloyz
提出日時 2021-11-14 13:37:11
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 1,198 ms / 2,000 ms
コード長 538 bytes
コンパイル時間 288 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 85,972 KB
最終ジャッジ日時 2024-05-07 02:39:54
合計ジャッジ時間 23,206 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 27 ms
10,752 KB
testcase_01 AC 26 ms
10,496 KB
testcase_02 AC 26 ms
10,496 KB
testcase_03 AC 43 ms
11,648 KB
testcase_04 AC 45 ms
11,904 KB
testcase_05 AC 45 ms
11,776 KB
testcase_06 AC 40 ms
11,648 KB
testcase_07 AC 41 ms
11,648 KB
testcase_08 AC 29 ms
10,496 KB
testcase_09 AC 996 ms
85,972 KB
testcase_10 AC 1,163 ms
70,120 KB
testcase_11 AC 1,157 ms
75,104 KB
testcase_12 AC 1,140 ms
74,688 KB
testcase_13 AC 1,149 ms
74,480 KB
testcase_14 AC 1,198 ms
78,232 KB
testcase_15 AC 1,188 ms
78,276 KB
testcase_16 AC 1,177 ms
79,332 KB
testcase_17 AC 1,136 ms
74,672 KB
testcase_18 AC 1,165 ms
76,672 KB
testcase_19 AC 1,141 ms
77,360 KB
testcase_20 AC 1,191 ms
75,660 KB
testcase_21 AC 1,177 ms
78,692 KB
testcase_22 AC 1,153 ms
76,864 KB
testcase_23 AC 1,143 ms
79,332 KB
testcase_24 AC 1,115 ms
72,208 KB
testcase_25 AC 1,096 ms
72,240 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, m, x = map(int, input().split())
AB = [list(map(int, input().split())) for _ in range(n)]
k = int(input())
C = list(map(int, input().split()))

AB.sort(key=lambda x: x[0], reverse=True)
seen = set()
P = []
for i in range(n):
    a, b = AB[i]
    if b not in seen:
        seen.add(b)
        P.append(a + x)
    else:
        P.append(a)
P.sort(reverse=True)
accumP = [0 for _ in range(n + 1)]
for i in range(n):
    accumP[i + 1] = accumP[i] + P[i]
ans = 0
for i in range(k):
    ans += accumP[C[i]]
print(ans)
0