結果

問題 No.2593 Reorder and Mod 120
ユーザー titiatitia
提出日時 2023-12-21 06:54:12
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 520 bytes
コンパイル時間 208 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 78,096 KB
最終ジャッジ日時 2023-12-21 06:54:16
合計ジャッジ時間 3,752 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 48 ms
61,004 KB
testcase_01 AC 47 ms
61,004 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 47 ms
61,004 KB
testcase_06 WA -
testcase_07 AC 46 ms
61,004 KB
testcase_08 AC 46 ms
61,004 KB
testcase_09 AC 48 ms
61,004 KB
testcase_10 AC 47 ms
61,004 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 AC 66 ms
75,820 KB
testcase_25 AC 69 ms
75,820 KB
testcase_26 AC 68 ms
75,820 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import Counter
from copy import deepcopy

N=int(input())
S=input()

C=Counter(S)

Q=[(C,0,0)]

ANS=[0]*120

while Q:
    x,keta,mod=Q.pop()

    if keta==3 or max(x.values())==0:
        count=0
        for i in range(10):
            count+=x[str(i)]

        ANS[(mod+40*count)%120]=1
        continue

    for i in range(10):
        if x[str(i)]>0:
            x[str(i)]-=1
            Q.append((deepcopy(x),keta+1,(mod+int(i)*(10**keta))%120))
            x[str(i)]+=1
            
print(sum(ANS))
0