結果
| 問題 | No.3500 01 String |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-10-10 17:03:07 |
| 言語 | C++23(gcc16) (gcc 16.1.0 + boost 1.92.0 + ACL) |
| 結果 |
WA
不安定
|
| 実行時間 | - |
| コード長 | 1,583 bytes |
| 記録 | |
| コンパイル時間 | 6,597 ms |
| コンパイル使用メモリ | 435,512 KB |
| 実行使用メモリ | 9,868 KB |
| 最終ジャッジ日時 | 2026-10-10 17:03:17 |
| 合計ジャッジ時間 | 8,297 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge5_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 WA * 1 |
| other | AC * 3 WA * 17 |
ソースコード
//謎の呪文
#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;
ar<mint,2>now;
if(a[0]=='1')now={0,1};
else now={1,1};
rep(i,1,n){
ar<mint,2>nxt;
if(a[i-1]=='0'&&a[i]=='1'){
nxt={now[0],now[0]+now[1]};
}
else if(a[i-1]=='1'&&a[i]=='0'){
nxt={now[0]+now[1],now[1]};
}
else{
nxt=now;
}
swap(now,nxt);
}
print(now[0].val()+now[1].val());
}
//cp template.cpp a.cpp