結果
問題 | No.2593 Reorder and Mod 120 |
ユーザー |
![]() |
提出日時 | 2023-12-21 06:55:46 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 519 bytes |
コンパイル時間 | 206 ms |
コンパイル使用メモリ | 82,376 KB |
実行使用メモリ | 83,960 KB |
最終ジャッジ日時 | 2024-09-27 10:47:07 |
合計ジャッジ時間 | 6,269 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 8 WA * 18 |
ソースコード
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==5 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))