結果

問題 No.3114 0→1
ユーザー Sillpherth
提出日時 2025-04-20 19:34:24
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 9 ms / 2,000 ms
コード長 511 bytes
コンパイル時間 703 ms
コンパイル使用メモリ 67,496 KB
実行使用メモリ 7,844 KB
最終ジャッジ日時 2025-04-20 19:34:26
合計ジャッジ時間 2,027 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
int A0(const std::string&_0,int _1,int _2){
int _3=(_2+1)/2,_4=_1+_3-1,_5=0,_6=0;
bool _7[_4],_8[_4];
for(int _9=0;_9<_3-1;_9++)_7[_9]=1;
for(int _9=_3-1;_9<_4;_9++)_7[_9]=_0[_9-_3+1]=='1';
for(int _9=0;_9<_4;_9++)_8[_9]=_7[_9];
for(int _9=0;_9<_2;_9++)_6+=_7[_9];
if(_6<_3){_7[_2-1]=1;_6++;_5++;}
for(int _9=1;_9<_4-_2+1;_9++){_6-=_7[_9-1];_6+=_7[_9+_2-1];if(_6<_3){_7[_9+_2-1]=1;_6++;_5++;}}
return _5;
}
int main(){
int _0;std::string _1;
std::cin>>_0>>_1;
std::cout<<A0(_1,_0,3)<<'\n';
}
0