Wrong Answer
Code
#include<iostream>
using namespace std;
int main()
{
int t;
cin>>t;
while(t--){
int n,k;
cin>>n>>k;
string s;
cin>>s;
int left=0, right = 0, count=0, ones=0;
while(right<n){
if(s[right]=='0'){
count++;
}
while(count>k){
if(s[left]=='0'){
count--;
}
left++;
}
ones = max(ones, right-left+1);
right++;
}
cout<<ones<<endl;
}
}
Information
- Submit By
- Type
- Submission
- Problem
- P1159 Binary String
- Contest
- Brain Booster #8
- Language
- C++17 (G++ 13.2.0)
- Submit At
- 2025-02-17 16:28:16
- Judged At
- 2025-02-17 16:28:16
- Judged By
- Score
- 0
- Total Time
- 28ms
- Peak Memory
- 532.0 KiB