結果

問題 No.2549 Paint Eggs
ユーザー sepa38sepa38
提出日時 2023-11-19 21:32:52
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 497 bytes
コンパイル時間 177 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 147,512 KB
最終ジャッジ日時 2023-11-19 21:33:07
合計ジャッジ時間 14,579 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 49 ms
64,856 KB
testcase_01 WA -
testcase_02 AC 51 ms
64,848 KB
testcase_03 AC 50 ms
64,180 KB
testcase_04 AC 47 ms
62,480 KB
testcase_05 WA -
testcase_06 AC 60 ms
68,720 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 183 ms
110,832 KB
testcase_13 AC 263 ms
122,904 KB
testcase_14 AC 176 ms
120,424 KB
testcase_15 WA -
testcase_16 AC 244 ms
120,380 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 379 ms
145,472 KB
testcase_21 WA -
testcase_22 AC 260 ms
145,592 KB
testcase_23 WA -
testcase_24 AC 279 ms
145,472 KB
testcase_25 AC 301 ms
145,096 KB
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 AC 336 ms
145,116 KB
testcase_30 AC 275 ms
145,464 KB
testcase_31 AC 343 ms
145,336 KB
testcase_32 WA -
testcase_33 WA -
testcase_34 AC 315 ms
144,752 KB
testcase_35 AC 262 ms
145,484 KB
testcase_36 AC 336 ms
145,592 KB
testcase_37 WA -
testcase_38 AC 316 ms
145,116 KB
testcase_39 AC 334 ms
145,336 KB
testcase_40 WA -
testcase_41 WA -
testcase_42 WA -
testcase_43 AC 273 ms
145,244 KB
testcase_44 AC 280 ms
145,244 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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)
0