| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 255125 | AM1648 | JJOOII 2 (JOI20_ho_t2) | C++17 | 0 ms | 384 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
/* 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], mapp[128];
string S;
int main() {
ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
mapp['J'] = 0, mapp['O'] = 1, mapp['I'] = 2;
cin >> n >> k >> S;
fori (i, n) ++cnt[mapp[S[i]]][i + 1];
fori (i, 3) fori (j, n + 1) cnt[i][j + 1] += cnt[i][j];
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';
}
컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
