結果
問題 | No.1708 Quality of Contest |
ユーザー | puzneko |
提出日時 | 2021-11-05 01:03:05 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 825 ms / 2,000 ms |
コード長 | 764 bytes |
コンパイル時間 | 164 ms |
コンパイル使用メモリ | 82,004 KB |
実行使用メモリ | 184,392 KB |
最終ジャッジ日時 | 2024-10-15 07:38:19 |
合計ジャッジ時間 | 14,081 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 23 |
ソースコード
from sys import stdin from heapq import heappush, heappop n, m, x, *indata = map(int, stdin.read().split()) offset = 0 hq = [] janru = [0 for i in range(n)] appeared = [0 for i in range(n)] for i in range(n): s, t = indata[offset + 2*i],indata[offset + 2*i+1] heappush(hq, (-(s+x),i)) janru[i] = t used = [0 for i in range(m+1)] manzoku = [0] while hq: score, ind = heappop(hq) score = -score if (appeared[ind] == 0) & (used[janru[ind]] >= 1): heappush(hq,(-score+x,ind)) appeared[ind] = 1 else: kari = manzoku[-1] + score used[janru[ind]] += 1 manzoku.append(kari) ans = 0 offset += n * 2 k = indata[offset] for i in range(1,k+1): ans += manzoku[indata[offset+i]] print("{}".format(ans))