結果
問題 |
No.1646 Avoid Palindrome
|
ユーザー |
![]() |
提出日時 | 2021-08-13 21:41:33 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 428 bytes |
コンパイル時間 | 195 ms |
コンパイル使用メモリ | 82,368 KB |
実行使用メモリ | 76,252 KB |
最終ジャッジ日時 | 2024-10-03 18:01:59 |
合計ジャッジ時間 | 3,407 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 9 WA * 31 |
ソースコード
n=int(input()) s=input() cnt=1 Mod=998244353 for i in range(n): if s[i]=='?': t=set() u=0 for j in [-2,-1,1,2]: if i+j>=0 and j<0: if s[i+j]=='?': u+=1 else: t.add(s[i+j]) elif j>0 and i+j<n and s[i+j]!='?': t.add(s[i+j]) cnt*=26-len(t)-u else: if i+1<n and s[i]==s[i+1]: cnt=0 if i+2<n and s[i]==s[i+2]: cnt=0 cnt%=Mod print(cnt)