답안 #1114655

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1114655 2024-11-19T10:23:51 Z AdamGS JJOOII 2 (JOI20_ho_t2) C++17
13 / 100
2000 ms 848 KB
#include <iostream>
#include <algorithm>
using namespace std;
int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n, k;
    cin>>n>>k;
    string s;
    cin>>s;
    int out=INT32_MAX;
    for (int i=0;i<n;i++){
        if (s[i]=='J'){
            int state=0;
            for (int j=i;j<n;j++){
                if ((s[j]=='J'&&state<k)||(s[j]=='O'&&state>=k&&state<2*k)||(s[j]=='I'&&state>=2*k)) state++;
                if (state==3*k) out=min(out, j-i+1-3*k);
            }
        }
    }
    cout<<(out==INT32_MAX?-1:out)<<'\n';
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 1 ms 456 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 1 ms 508 KB Output is correct
7 Correct 1 ms 504 KB Output is correct
8 Correct 1 ms 336 KB Output is correct
9 Correct 1 ms 336 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 1 ms 592 KB Output is correct
12 Correct 1 ms 336 KB Output is correct
13 Correct 1 ms 336 KB Output is correct
14 Correct 1 ms 336 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 1 ms 456 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 1 ms 508 KB Output is correct
7 Correct 1 ms 504 KB Output is correct
8 Correct 1 ms 336 KB Output is correct
9 Correct 1 ms 336 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 1 ms 592 KB Output is correct
12 Correct 1 ms 336 KB Output is correct
13 Correct 1 ms 336 KB Output is correct
14 Correct 1 ms 336 KB Output is correct
15 Correct 3 ms 336 KB Output is correct
16 Correct 6 ms 336 KB Output is correct
17 Correct 4 ms 464 KB Output is correct
18 Correct 2 ms 336 KB Output is correct
19 Correct 4 ms 460 KB Output is correct
20 Correct 5 ms 504 KB Output is correct
21 Correct 4 ms 336 KB Output is correct
22 Correct 4 ms 336 KB Output is correct
23 Correct 2 ms 336 KB Output is correct
24 Correct 4 ms 336 KB Output is correct
25 Correct 4 ms 336 KB Output is correct
26 Correct 4 ms 336 KB Output is correct
27 Correct 4 ms 336 KB Output is correct
28 Correct 4 ms 336 KB Output is correct
29 Correct 4 ms 336 KB Output is correct
30 Correct 4 ms 336 KB Output is correct
31 Correct 2 ms 336 KB Output is correct
32 Correct 4 ms 644 KB Output is correct
33 Correct 4 ms 336 KB Output is correct
34 Correct 4 ms 336 KB Output is correct
35 Correct 4 ms 336 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 1 ms 456 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 1 ms 508 KB Output is correct
7 Correct 1 ms 504 KB Output is correct
8 Correct 1 ms 336 KB Output is correct
9 Correct 1 ms 336 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 1 ms 592 KB Output is correct
12 Correct 1 ms 336 KB Output is correct
13 Correct 1 ms 336 KB Output is correct
14 Correct 1 ms 336 KB Output is correct
15 Correct 3 ms 336 KB Output is correct
16 Correct 6 ms 336 KB Output is correct
17 Correct 4 ms 464 KB Output is correct
18 Correct 2 ms 336 KB Output is correct
19 Correct 4 ms 460 KB Output is correct
20 Correct 5 ms 504 KB Output is correct
21 Correct 4 ms 336 KB Output is correct
22 Correct 4 ms 336 KB Output is correct
23 Correct 2 ms 336 KB Output is correct
24 Correct 4 ms 336 KB Output is correct
25 Correct 4 ms 336 KB Output is correct
26 Correct 4 ms 336 KB Output is correct
27 Correct 4 ms 336 KB Output is correct
28 Correct 4 ms 336 KB Output is correct
29 Correct 4 ms 336 KB Output is correct
30 Correct 4 ms 336 KB Output is correct
31 Correct 2 ms 336 KB Output is correct
32 Correct 4 ms 644 KB Output is correct
33 Correct 4 ms 336 KB Output is correct
34 Correct 4 ms 336 KB Output is correct
35 Correct 4 ms 336 KB Output is correct
36 Execution timed out 2064 ms 848 KB Time limit exceeded
37 Halted 0 ms 0 KB -