結果

問題 No.2178 Payable Magic Items
ユーザー 👑 KazunKazun
提出日時 2023-01-06 22:11:15
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 310 ms / 4,000 ms
コード長 491 bytes
コンパイル時間 416 ms
コンパイル使用メモリ 87,036 KB
実行使用メモリ 84,792 KB
最終ジャッジ日時 2023-08-21 08:17:17
合計ジャッジ時間 6,215 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 69 ms
71,080 KB
testcase_01 AC 71 ms
71,232 KB
testcase_02 AC 70 ms
70,988 KB
testcase_03 AC 166 ms
78,412 KB
testcase_04 AC 68 ms
70,948 KB
testcase_05 AC 163 ms
78,364 KB
testcase_06 AC 163 ms
78,228 KB
testcase_07 AC 68 ms
70,944 KB
testcase_08 AC 165 ms
78,176 KB
testcase_09 AC 90 ms
75,920 KB
testcase_10 AC 72 ms
75,228 KB
testcase_11 AC 305 ms
84,396 KB
testcase_12 AC 303 ms
84,792 KB
testcase_13 AC 310 ms
84,712 KB
testcase_14 AC 306 ms
84,680 KB
testcase_15 AC 305 ms
84,640 KB
testcase_16 AC 308 ms
84,472 KB
testcase_17 AC 227 ms
81,580 KB
testcase_18 AC 95 ms
76,608 KB
testcase_19 AC 139 ms
79,016 KB
testcase_20 AC 79 ms
75,344 KB
testcase_21 AC 96 ms
76,604 KB
testcase_22 AC 97 ms
76,352 KB
testcase_23 AC 80 ms
75,168 KB
testcase_24 AC 277 ms
83,128 KB
testcase_25 AC 207 ms
80,780 KB
testcase_26 AC 153 ms
79,060 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def solve():
    N,K=map(int,input().split())
    S=[None]*N
    for i in range(N):
        S[i]=int("4"*K,5)-int(input(),5)

    X=[0]*pow(5,K)
    for i in range(N):
        X[S[i]]+=1

    for d in range(K):
        t=pow(5,d)
        for i in range(pow(5,K)):
            if i//(5*t)==(i+t)//(5*t):
                X[i+t]+=X[i]

    ans=0
    for i in range(N):
        if X[S[i]]>=2:
            ans+=1
    return ans

#==================================================
print(solve())
0