結果
問題 | No.1708 Quality of Contest |
ユーザー | Igrmi |
提出日時 | 2021-10-15 22:10:43 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 697 ms / 2,000 ms |
コード長 | 675 bytes |
コンパイル時間 | 175 ms |
コンパイル使用メモリ | 81,848 KB |
実行使用メモリ | 136,492 KB |
最終ジャッジ日時 | 2023-10-17 20:21:25 |
合計ジャッジ時間 | 12,124 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 39 ms
53,544 KB |
testcase_01 | AC | 39 ms
53,544 KB |
testcase_02 | AC | 39 ms
53,544 KB |
testcase_03 | AC | 107 ms
76,792 KB |
testcase_04 | AC | 119 ms
77,400 KB |
testcase_05 | AC | 118 ms
77,292 KB |
testcase_06 | AC | 101 ms
76,536 KB |
testcase_07 | AC | 108 ms
76,768 KB |
testcase_08 | AC | 39 ms
53,544 KB |
testcase_09 | AC | 388 ms
136,492 KB |
testcase_10 | AC | 404 ms
123,008 KB |
testcase_11 | AC | 533 ms
116,084 KB |
testcase_12 | AC | 562 ms
112,608 KB |
testcase_13 | AC | 471 ms
115,888 KB |
testcase_14 | AC | 600 ms
117,944 KB |
testcase_15 | AC | 697 ms
133,032 KB |
testcase_16 | AC | 662 ms
132,428 KB |
testcase_17 | AC | 593 ms
121,008 KB |
testcase_18 | AC | 578 ms
114,072 KB |
testcase_19 | AC | 623 ms
119,788 KB |
testcase_20 | AC | 563 ms
120,716 KB |
testcase_21 | AC | 668 ms
125,800 KB |
testcase_22 | AC | 627 ms
118,328 KB |
testcase_23 | AC | 674 ms
132,456 KB |
testcase_24 | AC | 413 ms
115,104 KB |
testcase_25 | AC | 417 ms
115,104 KB |
ソースコード
import heapq N, M, X = map(int, input().split()) Problem = [[] for _ in range(M)] for _ in range(N): A, B = map(int, input().split()) Problem[B - 1].append(A) for i in range(M): Problem[i].sort() Problem.sort(key = lambda x: x[-1] if x else -1001001001) K = int(input()) C = list(map(int, input().split())) CCnt = [0] * (N + 1) for c in C: CCnt[c] += 1 Ans = 0 Score = 0 Used = [] for i in range(1, N + 1): if not Used or Problem and Problem[-1] and -Used[0] < X + Problem[-1][-1]: Score += X + Problem[-1].pop() for k in Problem.pop(): heapq.heappush(Used, -k) else: Score += -heapq.heappop(Used) Ans += Score * CCnt[i] print(Ans)