| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 254877 | imeimi2000 | JJOOII 2 (JOI20_ho_t2) | C++17 | 33 ms | 2044 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
int n, k;
char S[200002];
vector<int> P[4];
int main() {
ios_base::sync_with_stdio(0); cin.tie(0);
cin >> n >> k >> S + 1;
for (int i = 1; i <= n; ++i) {
P[S[i] == 'J' ? 1 : S[i] == 'O' ? 2 : 3].push_back(i);
}
int ans = n + 1;
for (int s = 1; s <= n; ++s) {
int e = s;
for (int i = 1; i <= 3; ++i) {
auto it = lower_bound(P[i].begin(), P[i].end(), e);
if (int(P[i].end() - it) < k) {
e = 10 * n;
break;
}
e = *(it + (k - 1));
}
ans = min(ans, (e - s + 1) - 3 * k);
}
printf("%d\n", ans > n ? -1 : ans);
return 0;
}
컴파일 시 표준 에러 (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... | ||||
