結果
| 問題 | No.2178 Payable Magic Items |
| コンテスト | |
| ユーザー |
ニックネーム
|
| 提出日時 | 2023-01-07 01:02:47 |
| 言語 | PyPy3 (7.3.23 + ACL) |
| 結果 |
TLE
不安定
|
| 実行時間 | - |
| コード長 | 344 bytes |
| 記録 | |
| コンパイル時間 | 71 ms |
| コンパイル使用メモリ | 81,404 KB |
| 実行使用メモリ | 127,348 KB |
| 最終ジャッジ日時 | 2026-10-03 14:56:06 |
| 合計ジャッジ時間 | 8,405 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge4_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 TLE * 1 |
| other | -- * 23 |
ソースコード
from functools import lru_cache
n,k = map(int,input().split())
a = {tuple(map(int,input())) for _ in range(n)}
@lru_cache
def main(s):
for i in range(k):
if s[i]<9:
t = list(s); t[i] += 1; t = tuple(t)
if t in a or main(t): return True
return False
ans = 0
for s in a:
if main(s): ans += 1
print(ans)
ニックネーム