結果
| 問題 | No.3500 01 String |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-04-17 21:11:06 |
| 言語 | PyPy3 (7.3.23 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 114 ms / 2,000 ms |
| + 992µs | |
| コード長 | 433 bytes |
| 記録 | |
| コンパイル時間 | 76 ms |
| コンパイル使用メモリ | 81,024 KB |
| 実行使用メモリ | 137,844 KB |
| 最終ジャッジ日時 | 2026-09-07 22:44:02 |
| 合計ジャッジ時間 | 3,277 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 20 |
ソースコード
n=int(input())
s=input()
res=[]
cnt=1
ans=0
for i in range(1,n):
if s[i]==s[i-1]:
cnt+=1
else:
res.append((s[i-1],cnt))
cnt=1
res.append((s[-1],cnt))
MOD=998244353
cnt0=0
cnt1=0
ans=1
for i in range(len(res)):
if res[i][0]=='0':
cnt0+=res[i][1]
else:
cnt1+=res[i][1]
if cnt0>0:
ans*=cnt0+cnt1+1
ans%=MOD
cnt0=0
cnt1=0
print(ans)