結果

問題 No.2178 Payable Magic Items
ユーザー 👑 p-adic
提出日時 2023-05-29 19:03:10
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 347 bytes
コンパイル時間 434 ms
コンパイル使用メモリ 82,432 KB
実行使用メモリ 81,280 KB
最終ジャッジ日時 2024-12-28 10:12:06
合計ジャッジ時間 12,553 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 22 TLE * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

I,R=input,range
N,K=map(int,I().split())
M=set()
P=pow(5,K-1)
for i in R(N):
	S=int(I(),5)
	for m in M:
		s,t,p,b=S,m,P,0
		for j in R(K):s,t,p,b=s%p,t%p,p//5,b+(t<s)
		if b<1:break
	else:
		L=[]
		for m in M:
			s,t,p,b=S,m,P,1
			for j in R(K):s,t,p,b=s%p,t%p,p//5,b*(t<=s)
			if b:L.append(m)
		for m in L:M.remove(m)
		M.add(S)
print(N-len(M))
0