結果
| 問題 | No.3500 01 String |
| コンテスト | |
| ユーザー |
YuukunA
|
| 提出日時 | 2026-04-18 11:23:16 |
| 言語 | Python3 (3.14.3 + numpy 2.4.4 + scipy 1.17.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 460 bytes |
| 記録 | |
| コンパイル時間 | 605 ms |
| コンパイル使用メモリ | 20,700 KB |
| 実行使用メモリ | 16,220 KB |
| 最終ジャッジ日時 | 2026-04-18 11:23:35 |
| 合計ジャッジ時間 | 15,951 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 WA * 2 |
| other | AC * 2 WA * 18 |
ソースコード
N = int(input())
A = input()
MOD = 998244353
dp = [1, 0, 0, 0]
for c in A:
nxt = [0] * 4
for s in range(4):
if not dp[s]: continue
L, R = s // 2, s % 2
if not (c == '1' and not R):
ns = L * 2 | (R or c == '0')
nxt[ns] = (nxt[ns] + dp[s]) % MOD
if not (c == '0' and not L):
ns = (L or c == '1') * 2 | R
nxt[ns] = (nxt[ns] + dp[s]) % MOD
dp = nxt
print(sum(dp) % MOD)
YuukunA