結果
| 問題 | No.2541 Divide 01 String |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-11-25 10:23:07 |
| 言語 | PyPy3 (8.0.1 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 55 ms / 2,000 ms |
| + 155µs | |
| コード長 | 255 bytes |
| 記録 | |
| コンパイル時間 | 86 ms |
| コンパイル使用メモリ | 64,056 KB |
| 実行使用メモリ | 66,308 KB |
| 最終ジャッジ日時 | 2026-11-21 04:28:07 |
| 合計ジャッジ時間 | 3,289 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 21 |
ソースコード
n = int(input())
S = list(map(int,input()))
mod = 998244353
dp = [1,0]
for s in S:
ndp = [0,0]
if s:
ndp[1] = (dp[1]*2 + dp[0]) % mod
else:
ndp[0] = (dp[0] + dp[1]) % mod
ndp[1] = dp[1]
dp = ndp
print(dp[1])