結果
| 問題 | No.2549 Paint Eggs |
| コンテスト | |
| ユーザー |
sepa38
|
| 提出日時 | 2023-11-19 21:32:52 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 497 bytes |
| 記録 | |
| コンパイル時間 | 294 ms |
| コンパイル使用メモリ | 85,120 KB |
| 実行使用メモリ | 155,064 KB |
| 最終ジャッジ日時 | 2026-04-13 09:39:15 |
| 合計ジャッジ時間 | 13,684 ms |
|
ジャッジサーバーID (参考情報) |
judge3_1 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 23 WA * 22 |
ソースコード
import heapq
n, m, k = map(int, input().split())
c = list(map(lambda x: int(x)-1, input().split()))
a = list(map(int, input().split()))
d = dict()
for i in range(m):
d[i] = a[i] * k
for i in range(k):
d[c[i]] -= a[c[i]]
ans = min(d.values())
# print(d)
h = []
for i in d.keys():
heapq.heappush(h, m*d[i]+i)
for i in range(n-k):
while h:
cost, idx = divmod(heapq.heappop(h), m)
if d[idx] == cost:
ans = min(ans, cost)
heapq.heappush(h, m*cost+idx)
break
print(ans)
sepa38