#include <bits/stdc++.h>
#define int long long
#define rp(i, x, y) for(int i = x; i <= y; i ++ )
#define dw(i, x, y) for(int i = x; i >= y; i -- )
using namespace std;
int n, m, a, b; // have hvnot
int y; // std
string s;
signed main() {
cin >> n >> m >> s;
a = m;
for (auto i : s)
if (i == '0') {
a = m, b = y;
} else if (i == '1') {
if (a == 0) {
if (b > 0) b -- ;
else y ++ ;
}
else a -- ;
} else {
if (b > 0) b -- ;
else y ++ ;
}
cout << y;
}
[ABC332C] T-shirts
最新推荐文章于 2024-07-20 09:51:47 发布