# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
255128 |
2020-07-31T10:02:50 Z |
AM1648 |
JJOOII 2 (JOI20_ho_t2) |
C++17 |
|
1 ms |
384 KB |
/* be name khoda */
#include <bits/stdc++.h>
using namespace std;
typedef int ll;
#define forifrom(i, s, n) for (ll i = s; i < n; ++i)
#define fori(i, n) forifrom(i, 0, n)
// ------------------------------------------------------------------
const ll maxn = 200010;
ll n, k, cnt[3][maxn];
string S, C;
int main() {
ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
cin >> n >> k >> S;
S += '#';
C = "JOI";
fori (i, 3) fori (j, n + 1) cnt[i][j + 1] = cnt[i][j] + (S[j] == C[i]);
ll ans = -1;
fori (i, n) {
ll i1 = lower_bound(cnt[0], cnt[0] + n + 1, k + cnt[0][i]) - cnt[0];
ll i2 = lower_bound(cnt[1], cnt[1] + n + 1, k + cnt[1][i1]) - cnt[1];
ll i3 = lower_bound(cnt[2], cnt[2] + n + 1, k + cnt[2][i2]) - cnt[2];
if (i3 <= n) ans = max(ans, i + n - i3);
}
cout << ans << '\n';
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
384 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
384 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
384 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |