結果
| 問題 | No.3500 01 String |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-04-18 20:08:05 |
| 言語 | C++14 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,163 bytes |
| 記録 | |
| コンパイル時間 | 4,348 ms |
| コンパイル使用メモリ | 245,504 KB |
| 実行使用メモリ | 7,972 KB |
| 最終ジャッジ日時 | 2026-04-18 20:08:15 |
| 合計ジャッジ時間 | 5,706 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge1_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 16 WA * 4 |
ソースコード
// @yuuzaa_tkms
#include <bits/stdc++.h>
#include <atcoder/all>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define Ye cout<<"Yes"<<endl
#define YE cout<<"YES"<<endl
#define No cout<<"No"<<endl
#define NO cout<<"NO"<<endl
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define vec vector
using namespace std;
using ll=long long;
using ull=unsigned long long;
using namespace atcoder;
using mint=modint998244353;
vector<int>dx={0,1,0,-1,-1,-1,1,1};
vector<int>dy={1,0,-1,0,-1,1,-1,1};
int INF=1e9;
ull LINF=1e18;
bool edge(int x,int y,int H,int W){
if(x<0||x>=H||y<0||y>=W)return 0;
else return 1;
}
//実装は丁寧に書こう
//1400復帰しよう!
int main(){
int N;
cin>>N;
string A;
cin>>A;
int now=0;
bool z=0,o=0;
mint ans=1;
rep(i,N){
now++;
if(A[i]=='0')z=1;
if(A[i]=='1')o=1;
if(i!=N-1&&A[i]=='1'&&A[i+1]=='0'&&z&&o){
ans*=now+1;
now=0;
z=0;
o=0;
}
}
if(z&&o)ans*=now+1;
cout<<ans.val()<<endl;
}