結果
| 問題 | No.2541 Divide 01 String |
| コンテスト | |
| ユーザー |
timi
|
| 提出日時 | 2023-12-01 14:34:31 |
| 言語 | PyPy3 (7.3.23 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 92 ms / 2,000 ms |
| + 449µs | |
| コード長 | 324 bytes |
| 記録 | |
| コンパイル時間 | 235 ms |
| コンパイル使用メモリ | 96,464 KB |
| 実行使用メモリ | 92,288 KB |
| 最終ジャッジ日時 | 2026-09-04 23:54:12 |
| 合計ジャッジ時間 | 3,948 ms |
|
ジャッジサーバーID (参考情報) |
judge4_1 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 20 |
ソースコード
N=int(input())
S=input()
if S=='0'*N:
print(0)
exit()
from collections import deque
d=deque()
for s in S:
d.append(s)
while d[0]=='0':
d.popleft()
while d[-1]=='0':
d.pop()
d.popleft()
ans=1;now=0
while d:
c=d.popleft()
if c=='0':
now+=1
else:
ans*=now+2
now=0
ans%=998244353
print(ans)
timi