結果

問題 No.2178 Payable Magic Items
ユーザー titiatitia
提出日時 2023-01-07 03:13:59
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 533 ms / 4,000 ms
コード長 498 bytes
コンパイル時間 471 ms
コンパイル使用メモリ 86,888 KB
実行使用メモリ 145,988 KB
最終ジャッジ日時 2023-08-21 08:28:50
合計ジャッジ時間 7,988 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 80 ms
78,744 KB
testcase_01 AC 81 ms
78,736 KB
testcase_02 AC 81 ms
78,900 KB
testcase_03 AC 270 ms
80,004 KB
testcase_04 AC 80 ms
78,540 KB
testcase_05 AC 86 ms
79,220 KB
testcase_06 AC 95 ms
79,588 KB
testcase_07 AC 82 ms
78,776 KB
testcase_08 AC 95 ms
79,452 KB
testcase_09 AC 95 ms
79,256 KB
testcase_10 AC 83 ms
79,272 KB
testcase_11 AC 427 ms
145,988 KB
testcase_12 AC 520 ms
145,660 KB
testcase_13 AC 530 ms
145,648 KB
testcase_14 AC 524 ms
145,512 KB
testcase_15 AC 523 ms
145,880 KB
testcase_16 AC 533 ms
145,712 KB
testcase_17 AC 374 ms
100,220 KB
testcase_18 AC 112 ms
80,728 KB
testcase_19 AC 188 ms
96,072 KB
testcase_20 AC 95 ms
79,788 KB
testcase_21 AC 105 ms
79,768 KB
testcase_22 AC 107 ms
80,988 KB
testcase_23 AC 97 ms
79,892 KB
testcase_24 AC 472 ms
123,716 KB
testcase_25 AC 322 ms
87,840 KB
testcase_26 AC 216 ms
102,812 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

N,K=map(int,input().split())
S=[list(map(int,list(input().strip()))) for i in range(N)]

X=[]

for s in S:
    a=0
    for i in range(len(s)):
        a+=(5**i)*s[i]
    X.append(a)


USED=[0]*(5**8+1)

SET=set(X)

ANS=0

for i in range(5**8,-1,-1):
    if i in SET:
        if USED[i]==1:
            ANS+=1
        USED[i]=1
    if USED[i]==1:
        for j in range(8):
            if (i%(5**(j+1)))//(5**j)!=0:
                USED[i-(5**j)]=1

print(ANS)
0