結果
| 問題 | No.3500 01 String |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-10-10 17:38:30 |
| 言語 | C++23(gcc16) (gcc 16.1.0 + boost 1.92.0 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 7 ms / 2,000 ms |
| + 261µs | |
| コード長 | 1,440 bytes |
| 記録 | |
| コンパイル時間 | 7,881 ms |
| コンパイル使用メモリ | 437,988 KB |
| 実行使用メモリ | 9,824 KB |
| 最終ジャッジ日時 | 2026-10-10 17:38:42 |
| 合計ジャッジ時間 | 8,866 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge4_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 20 |
ソースコード
//謎の呪文
#ifdef ONLINE_JUDGE
//あとこだ
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#else
//手元
#endif
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
using ll=long long;
using ld=long double;
using vl=vector<ll>;
using vb=vector<bool>;
template<class T>using ve=vector<T>;
template<class T,ll num>using ar=array<T,num>;
template<class T>using pq=priority_queue<T, vector<T>>;
template<class T>using pq_g=priority_queue<T, vector<T>, greater<T>>;
#define print(a) cout<<a<<'\n'
#define rep(i,a,b) for(ll i=(a);i<(b);i++)
#define drep(i,a,b) for(ll i=(a);i>(b);i--)
#define all(v) v.begin(),v.end()
#define dall(v) v.rbegin(),v.rend()
#define pyes print("Yes")
#define pno print("No")
template<class T>istream&operator>>(istream&i,vector<T>&v){rep(j,0,(ll)size(v))i>>v[j];return i;}
template<class T,size_t N>istream&operator>>(istream&i,array<T,N>&v){rep(j,0,(ll)N)i>>v[j];return i;}
//ほんへ
using mint=modint998244353;
int main(){
//呪い
ios::sync_with_stdio(false);
cin.tie(nullptr);
//やれ
ll n;
string a;
cin>>n>>a;
vl pos;
if(a[0]=='0')pos.push_back(-1);
if(a[n-1]=='1')pos.push_back(n-1);
rep(i,0,n-1)if(a[i]=='1'&&a[i+1]=='0')pos.push_back(i);
sort(all(pos));
mint res=1;
rep(i,1,pos.size())res*=1+pos[i]-pos[i-1];
print(res.val());
}
//cp template.cpp a.cpp