# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
20801 | 2017-02-16T07:51:56 Z | jjwdi0 | JOIOJI (JOI14_joioji) | C++11 | 43 ms | 7896 KB |
#include <bits/stdc++.h> using namespace std; typedef pair<int, int> pr; int N, J, O, ans; char A[200005]; map<pr, int> m; int main() { scanf("%d %s", &N, A); m[pr(0, 0)] = -1; for(int i=0; i<N; i++) { if(A[i] == 'J') J++; if(A[i] == 'O') O++; if(A[i] == 'I') J--, O--; if(m.find(pr(J, O)) != m.end()) ans = max(ans, i - m[pr(J, O)]); else m[pr(J, O)] = i; } printf("%d\n", ans); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 2220 KB | Output is correct |
2 | Correct | 0 ms | 2220 KB | Output is correct |
3 | Correct | 0 ms | 2220 KB | Output is correct |
4 | Correct | 0 ms | 2220 KB | Output is correct |
5 | Correct | 0 ms | 2220 KB | Output is correct |
6 | Correct | 0 ms | 2220 KB | Output is correct |
7 | Correct | 0 ms | 2220 KB | Output is correct |
8 | Correct | 0 ms | 2220 KB | Output is correct |
9 | Correct | 0 ms | 2220 KB | Output is correct |
10 | Correct | 0 ms | 2220 KB | Output is correct |
11 | Correct | 0 ms | 2220 KB | Output is correct |
12 | Correct | 0 ms | 2220 KB | Output is correct |
13 | Correct | 0 ms | 2220 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 2220 KB | Output is correct |
2 | Correct | 0 ms | 2352 KB | Output is correct |
3 | Correct | 0 ms | 2352 KB | Output is correct |
4 | Correct | 0 ms | 2352 KB | Output is correct |
5 | Correct | 0 ms | 2352 KB | Output is correct |
6 | Correct | 0 ms | 2220 KB | Output is correct |
7 | Correct | 0 ms | 2352 KB | Output is correct |
8 | Correct | 0 ms | 2352 KB | Output is correct |
9 | Correct | 0 ms | 2352 KB | Output is correct |
10 | Correct | 0 ms | 2352 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 2352 KB | Output is correct |
2 | Correct | 6 ms | 2880 KB | Output is correct |
3 | Correct | 9 ms | 3276 KB | Output is correct |
4 | Correct | 19 ms | 4068 KB | Output is correct |
5 | Correct | 29 ms | 5124 KB | Output is correct |
6 | Correct | 33 ms | 5124 KB | Output is correct |
7 | Correct | 43 ms | 5652 KB | Output is correct |
8 | Correct | 43 ms | 4992 KB | Output is correct |
9 | Correct | 39 ms | 5388 KB | Output is correct |
10 | Correct | 36 ms | 5124 KB | Output is correct |
11 | Correct | 36 ms | 6840 KB | Output is correct |
12 | Correct | 23 ms | 3804 KB | Output is correct |
13 | Correct | 16 ms | 3144 KB | Output is correct |
14 | Correct | 33 ms | 7896 KB | Output is correct |
15 | Correct | 13 ms | 2880 KB | Output is correct |