# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
20800 | 2017-02-16T07:51:08 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); 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
# | Verdict | Execution time | Memory | 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 | Incorrect | 0 ms | 2220 KB | Output isn't correct |
10 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | 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 |
# | Verdict | Execution time | Memory | 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 | 33 ms | 5124 KB | Output is correct |
6 | Correct | 43 ms | 5124 KB | Output is correct |
7 | Correct | 36 ms | 5652 KB | Output is correct |
8 | Correct | 43 ms | 4992 KB | Output is correct |
9 | Correct | 43 ms | 5388 KB | Output is correct |
10 | Correct | 39 ms | 5124 KB | Output is correct |
11 | Correct | 33 ms | 6840 KB | Output is correct |
12 | Correct | 19 ms | 3804 KB | Output is correct |
13 | Correct | 19 ms | 3144 KB | Output is correct |
14 | Correct | 33 ms | 7896 KB | Output is correct |
15 | Correct | 13 ms | 2880 KB | Output is correct |