結果

問題 No.2772 Appearing Even Times
ユーザー 👑 timitimi
提出日時 2024-06-02 23:45:19
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 687 bytes
コンパイル時間 375 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 77,440 KB
最終ジャッジ日時 2024-06-02 23:45:44
合計ジャッジ時間 23,360 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 54 ms
64,896 KB
testcase_01 AC 58 ms
65,536 KB
testcase_02 AC 61 ms
65,280 KB
testcase_03 AC 59 ms
65,408 KB
testcase_04 AC 59 ms
65,152 KB
testcase_05 AC 66 ms
68,736 KB
testcase_06 AC 60 ms
65,152 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 1,857 ms
76,800 KB
testcase_13 AC 1,764 ms
77,440 KB
testcase_14 AC 1,799 ms
76,960 KB
testcase_15 AC 1,818 ms
77,184 KB
testcase_16 AC 1,878 ms
76,800 KB
testcase_17 AC 1,798 ms
76,928 KB
testcase_18 AC 1,795 ms
77,184 KB
testcase_19 AC 1,789 ms
76,800 KB
testcase_20 WA -
testcase_21 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

S=input()
U=[0 for i in range(1<<10)]
T=[0 for i in range(1<<10)]
C=[0]*10;mod=998244353


for i in range(1,int(S[0])+1):
  if i!=int(S[0]):
    U[1<<i]+=1
  else:
    T[1<<i]+=1
    
for i in range(1,len(S)):
  s=int(S[i]) 
  C[s]+=1
  C[s]%=2
  NU=[0 for _ in range(1<<10)]
  NT=[0 for _ in range(1<<10)]
  for bit in range(1<<10):
    for k in range(10):
      nex=bit^(1<<k)
      NU[nex]+=U[bit]
      NU[nex]%=mod 
      if k==s:
        NT[nex]+=T[bit]
        NT[nex]%=mod
      elif k<s:
        NU[nex]+=T[bit]
        NU[nex]%=mod
  if i!=0:
    for j in range(1,10):
      NU[1<<j]+=1
  U=NU;T=NT
        
ans=U[0]%mod
if sum(C)==0:
  print((ans+1)%mod)
else:
  print(ans)
  
0