結果
問題 | No.1708 Quality of Contest |
ユーザー | tktk_snsn |
提出日時 | 2021-10-16 15:06:11 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
AC
|
実行時間 | 1,816 ms / 2,000 ms |
コード長 | 900 bytes |
コンパイル時間 | 116 ms |
コンパイル使用メモリ | 11,848 KB |
実行使用メモリ | 61,544 KB |
最終ジャッジ日時 | 2023-10-17 22:12:40 |
合計ジャッジ時間 | 30,830 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 30 ms
10,132 KB |
testcase_01 | AC | 30 ms
10,132 KB |
testcase_02 | AC | 30 ms
10,132 KB |
testcase_03 | AC | 45 ms
10,864 KB |
testcase_04 | AC | 47 ms
10,928 KB |
testcase_05 | AC | 46 ms
11,032 KB |
testcase_06 | AC | 40 ms
10,792 KB |
testcase_07 | AC | 41 ms
10,760 KB |
testcase_08 | AC | 30 ms
10,132 KB |
testcase_09 | AC | 1,421 ms
50,684 KB |
testcase_10 | AC | 1,771 ms
60,656 KB |
testcase_11 | AC | 1,775 ms
59,712 KB |
testcase_12 | AC | 1,738 ms
59,940 KB |
testcase_13 | AC | 1,769 ms
59,584 KB |
testcase_14 | AC | 1,709 ms
59,860 KB |
testcase_15 | AC | 1,560 ms
60,844 KB |
testcase_16 | AC | 1,675 ms
60,568 KB |
testcase_17 | AC | 1,777 ms
61,320 KB |
testcase_18 | AC | 1,777 ms
61,440 KB |
testcase_19 | AC | 1,668 ms
61,544 KB |
testcase_20 | AC | 1,699 ms
61,248 KB |
testcase_21 | AC | 1,586 ms
60,292 KB |
testcase_22 | AC | 1,569 ms
59,916 KB |
testcase_23 | AC | 1,556 ms
60,832 KB |
testcase_24 | AC | 1,754 ms
58,908 KB |
testcase_25 | AC | 1,816 ms
58,884 KB |
ソースコード
from collections import Counter import heapq import sys input = sys.stdin.buffer.readline sys.setrecursionlimit(10 ** 7) N, M, X = map(int, input().split()) P = [] for _ in range(N): a, b = map(int, input().split()) b -= 1 P.append((-a, b)) used = [False] * M order = [] heapq.heapify(P) Q = [] def push(que): a, b = heapq.heappop(que) used[b] = True order.append((-a, b)) for _ in range(N): while P and used[P[0][1]]: heapq.heappush(Q, heapq.heappop(P)) if P and Q: if (-P[0][0] + X) > -Q[0][0]: push(P) else: push(Q) elif P: push(P) else: push(Q) K = int(input()) C = Counter(map(int, input().split())) ans = 0 used = [False] * M score = 0 for i, (a, b) in enumerate(order, 1): score += a if not used[b]: score += X used[b] = True ans += C[i] * score print(ans)