結果

問題 No.2178 Payable Magic Items
ユーザー ニックネームニックネーム
提出日時 2023-01-07 01:25:21
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 3,508 ms / 4,000 ms
コード長 381 bytes
コンパイル時間 4,330 ms
コンパイル使用メモリ 82,840 KB
実行使用メモリ 275,628 KB
最終ジャッジ日時 2023-08-21 08:32:37
合計ジャッジ時間 45,543 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 76 ms
75,032 KB
testcase_01 AC 73 ms
71,152 KB
testcase_02 AC 72 ms
71,024 KB
testcase_03 AC 2,248 ms
249,624 KB
testcase_04 AC 73 ms
71,156 KB
testcase_05 AC 2,296 ms
249,580 KB
testcase_06 AC 2,293 ms
249,548 KB
testcase_07 AC 76 ms
71,016 KB
testcase_08 AC 2,356 ms
249,552 KB
testcase_09 AC 455 ms
106,432 KB
testcase_10 AC 89 ms
76,652 KB
testcase_11 AC 3,444 ms
268,856 KB
testcase_12 AC 3,395 ms
268,280 KB
testcase_13 AC 3,432 ms
268,504 KB
testcase_14 AC 3,334 ms
268,372 KB
testcase_15 AC 3,508 ms
268,548 KB
testcase_16 AC 3,461 ms
268,408 KB
testcase_17 AC 2,903 ms
272,628 KB
testcase_18 AC 128 ms
78,336 KB
testcase_19 AC 609 ms
119,452 KB
testcase_20 AC 100 ms
76,756 KB
testcase_21 AC 128 ms
78,060 KB
testcase_22 AC 131 ms
78,596 KB
testcase_23 AC 97 ms
76,648 KB
testcase_24 AC 3,141 ms
275,628 KB
testcase_25 AC 2,601 ms
256,468 KB
testcase_26 AC 653 ms
124,256 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,k = map(int,input().split())
a = {tuple(map(int,input())) for _ in range(n)}
d = {}
for i in range(5**k-1, -1, -1):
    t = []
    for _ in range(k): t.append(i%5); i //= 5
    t = tuple(t); f = False
    for j in range(k):
        if t[j]<4:
            u = list(t); u[j] += 1; u = tuple(u)
            f |= u in a or d[u]
    d[t] = f
ans = 0
for s in a: ans += d[s]
print(ans)
0