結果
問題 |
No.3114 0→1
|
ユーザー |
|
提出日時 | 2025-04-18 21:36:33 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 4 ms / 2,000 ms |
コード長 | 742 bytes |
コンパイル時間 | 5,347 ms |
コンパイル使用メモリ | 334,328 KB |
実行使用メモリ | 7,848 KB |
最終ジャッジ日時 | 2025-04-18 21:36:40 |
合計ジャッジ時間 | 6,300 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 30 |
ソースコード
#include<bits/stdc++.h> using namespace std; #include<atcoder/all> using namespace atcoder; using mint=atcoder::modint998244353; #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") #define int long long #define rep(i,n) for(int i=0;i<(n);i++) #define rng(i,l,r) for(int i=(l);i<(r);i++) #define rrep(i,n) for(int i=(n)-1;i>=0;i--) #define rrng(i,l,r) for(int i=(r)-1;i>=(l);i--) #define fi first #define se second #define all(x) (x).begin(),(x).end() struct fast_io{fast_io(){cin.tie(nullptr)->sync_with_stdio(false);}}_; signed main(){ int N;cin>>N; string S;cin>>S; int ans=0; rep(i,N){ if(S[i]=='1')continue; rng(j,i+1,min(N,i+3)){ if(S[j]=='0'){ S[j]='1'; ans++; } } } cout<<ans<<endl; }