結果

問題 No.2178 Payable Magic Items
ユーザー 👑 p-adicp-adic
提出日時 2023-05-29 22:05:04
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 270 bytes
コンパイル時間 512 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 86,400 KB
最終ジャッジ日時 2024-06-08 19:28:13
合計ジャッジ時間 6,949 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 42 ms
57,088 KB
testcase_01 AC 41 ms
52,096 KB
testcase_02 AC 40 ms
51,712 KB
testcase_03 AC 229 ms
73,856 KB
testcase_04 AC 41 ms
51,712 KB
testcase_05 AC 58 ms
62,592 KB
testcase_06 AC 90 ms
71,296 KB
testcase_07 AC 41 ms
51,712 KB
testcase_08 AC 89 ms
71,808 KB
testcase_09 AC 77 ms
68,608 KB
testcase_10 AC 41 ms
51,968 KB
testcase_11 TLE -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

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