結果

問題 No.3114 0→1
ユーザー Sillpherth
提出日時 2025-04-20 19:35:20
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 8 ms / 2,000 ms
コード長 460 bytes
コンパイル時間 862 ms
コンパイル使用メモリ 66,744 KB
実行使用メモリ 7,844 KB
最終ジャッジ日時 2025-04-20 19:35:23
合計ジャッジ時間 2,436 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
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 i=0;i<_4;i++)
_7[i]=(i<_3-1)||_0[i-_3+1]=='1';
for(int i=0;i<_4;i++)_8[i]=_7[i];
for(int i=0;i<_2;i++)_6+=_7[i];
if(_6<_3)_7[_2-1]=_6++>0,_5++;
for(int i=1;i<_4-_2+1;i++)
_6-=_7[i-1],_6+=_7[i+_2-1],
_6<_3?(_7[i+_2-1]=1,_6++,_5++):0;
return _5;
}
int main(){
int _0;std::string _1;
std::cin>>_0>>_1;
std::cout<<A0(_1,_0,3)<<'\n';
}
0