結果

問題 No.2178 Payable Magic Items
ユーザー 👑 p-adicp-adic
提出日時 2023-05-29 22:08:04
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 282 bytes
コンパイル時間 100 ms
コンパイル使用メモリ 10,788 KB
実行使用メモリ 20,400 KB
最終ジャッジ日時 2023-08-27 23:56:57
合計ジャッジ時間 7,698 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 14 ms
7,856 KB
testcase_01 AC 15 ms
7,856 KB
testcase_02 AC 15 ms
7,988 KB
testcase_03 AC 1,323 ms
11,204 KB
testcase_04 AC 15 ms
7,892 KB
testcase_05 AC 45 ms
11,172 KB
testcase_06 AC 110 ms
11,172 KB
testcase_07 AC 15 ms
7,852 KB
testcase_08 AC 110 ms
11,248 KB
testcase_09 AC 53 ms
8,796 KB
testcase_10 AC 16 ms
7,864 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]*(b[s]<2)
	while len(L):
		s=L.pop()
		for q in p:
			if s%(q*5)//q*(b[s-q]<2):
				L.append(s-q)
				a,b[s-q]=a+(b[s-q]==1),2
print(a)
0