結果
| 問題 |
No.1646 Avoid Palindrome
|
| コンテスト | |
| ユーザー |
とりゐ
|
| 提出日時 | 2021-08-13 21:40:36 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 423 bytes |
| コンパイル時間 | 151 ms |
| コンパイル使用メモリ | 82,104 KB |
| 実行使用メモリ | 76,228 KB |
| 最終ジャッジ日時 | 2024-10-03 17:58:57 |
| 合計ジャッジ時間 | 3,276 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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 0<=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)
とりゐ