結果
問題 | No.2178 Payable Magic Items |
ユーザー | Hydru |
提出日時 | 2023-01-06 23:01:36 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 1,315 ms / 4,000 ms |
コード長 | 1,057 bytes |
コンパイル時間 | 440 ms |
コンパイル使用メモリ | 86,768 KB |
実行使用メモリ | 147,056 KB |
最終ジャッジ日時 | 2023-08-21 08:21:08 |
合計ジャッジ時間 | 10,703 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 77 ms
71,024 KB |
testcase_01 | AC | 74 ms
71,148 KB |
testcase_02 | AC | 72 ms
71,332 KB |
testcase_03 | AC | 73 ms
70,900 KB |
testcase_04 | AC | 73 ms
71,324 KB |
testcase_05 | AC | 74 ms
70,968 KB |
testcase_06 | AC | 91 ms
76,964 KB |
testcase_07 | AC | 74 ms
70,960 KB |
testcase_08 | AC | 100 ms
76,944 KB |
testcase_09 | AC | 94 ms
77,152 KB |
testcase_10 | AC | 73 ms
71,072 KB |
testcase_11 | AC | 1,006 ms
132,632 KB |
testcase_12 | AC | 394 ms
132,156 KB |
testcase_13 | AC | 1,315 ms
147,056 KB |
testcase_14 | AC | 397 ms
131,800 KB |
testcase_15 | AC | 398 ms
132,100 KB |
testcase_16 | AC | 397 ms
132,016 KB |
testcase_17 | AC | 1,024 ms
118,500 KB |
testcase_18 | AC | 128 ms
78,104 KB |
testcase_19 | AC | 170 ms
89,632 KB |
testcase_20 | AC | 86 ms
76,168 KB |
testcase_21 | AC | 109 ms
77,704 KB |
testcase_22 | AC | 112 ms
77,728 KB |
testcase_23 | AC | 89 ms
76,192 KB |
testcase_24 | AC | 1,178 ms
134,588 KB |
testcase_25 | AC | 957 ms
110,404 KB |
testcase_26 | AC | 196 ms
94,504 KB |
ソースコード
n,k=map(int,input().split()) if n==1 or k==1: print(n-1) exit() S=[input() for _ in range(n)] X=[list(int(s) for s in S[i]) for i in range(n)] A=[sum(x) for x in X] entry_set=set(S) max_A=max(A) if max_A==4*k: print(n-1) exit() remove_set=set() for i in range(n): if A[i]==max_A: entry_set.remove(S[i]) for j in range(k): if X[i][j]==0: continue remove_set.add("".join([str(X[i][l]-1) if l==j else str(X[i][l]) for l in range(k)])) num=max_A-1 ans=0 while(entry_set): for i in range(n): if A[i]==num: if S[i] in remove_set: ans+=1 else: remove_set.add(S[i]) entry_set.remove(S[i]) _remove_set=set() for r in remove_set: for j in range(k): if r[j]=="0": continue R=list(r) R[j]=str(int(R[j])-1) _remove_set.add("".join(R)) remove_set=_remove_set num-=1 if num==-1: break print(ans)