結果
| 問題 |
No.2178 Payable Magic Items
|
| コンテスト | |
| ユーザー |
👑 |
| 提出日時 | 2023-05-29 22:05:04 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 270 bytes |
| コンパイル時間 | 336 ms |
| コンパイル使用メモリ | 82,196 KB |
| 実行使用メモリ | 156,288 KB |
| 最終ジャッジ日時 | 2024-12-28 10:23:23 |
| 合計ジャッジ時間 | 54,527 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 14 TLE * 9 |
ソースコード
I,R=input,range
N,K=map(int,I().split())
p=[pow(5,i)for i in R(K+1)]
S=[int(I(),5)for i in R(N)]
b=[s in S for s in R(p[K])]
a=0
for s in S:
L={s}
while len(L):
s=L.pop()
for q in p:
if s%(q*5)//q*(b[s-q]<2):
L.add(s-q)
a,b[s-q]=a+(b[s-q]==1),2
print(a)