Wrong Answer
Code
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;
int x(string &m, int n, int o) {
int p = 0, q = 0, r = 0;
for (int s = 0; s < n; s++) {
if (m[s] == '0') q++;
while (q > o) {
if (m[p] == '0') q--;
p++;
}
r = max(r, s - p + 1);
}
return r;
}
int main() {
int a;
cin >> a;
while (a--) {
int b, c;
string d;
cin >> b >> c >> d;
cout << x(d, b, c) << endl;
}
return 0;
}
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 15:36:51
- Judged At
- 2025-02-17 15:36:51
- Judged By
- Score
- 0
- Total Time
- 26ms
- Peak Memory
- 564.0 KiB