# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
163198 | 2019-11-11T18:03:01 Z | TadijaSebez | JOIOJI (JOI14_joioji) | C++11 | 95 ms | 6264 KB |
#include <bits/stdc++.h> using namespace std; const int N=200050; char s[N]; int main() { int n,IJ=0,IO=0; scanf("%i",&n); scanf("%s",s+1); map<pair<int,int>,int> fir; fir[{0,0}]=0; int ans=0; for(int i=1;i<=n;i++) { if(s[i]=='I') IJ++,IO++; if(s[i]=='J') IJ--; if(s[i]=='O') IO--; if(fir.count({IJ,IO})) ans=max(ans,i-fir[{IJ,IO}]); else fir[{IJ,IO}]=i; } printf("%i\n",ans); return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 256 KB | Output is correct |
4 | Correct | 2 ms | 376 KB | Output is correct |
5 | Correct | 2 ms | 256 KB | Output is correct |
6 | Correct | 2 ms | 376 KB | Output is correct |
7 | Correct | 2 ms | 256 KB | Output is correct |
8 | Correct | 2 ms | 376 KB | Output is correct |
9 | Correct | 2 ms | 376 KB | Output is correct |
10 | Correct | 2 ms | 376 KB | Output is correct |
11 | Correct | 2 ms | 376 KB | Output is correct |
12 | Correct | 2 ms | 376 KB | Output is correct |
13 | Correct | 2 ms | 256 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 3 ms | 376 KB | Output is correct |
3 | Correct | 3 ms | 376 KB | Output is correct |
4 | Correct | 3 ms | 476 KB | Output is correct |
5 | Correct | 3 ms | 364 KB | Output is correct |
6 | Correct | 3 ms | 376 KB | Output is correct |
7 | Correct | 3 ms | 376 KB | Output is correct |
8 | Correct | 3 ms | 504 KB | Output is correct |
9 | Correct | 3 ms | 504 KB | Output is correct |
10 | Correct | 3 ms | 504 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 504 KB | Output is correct |
2 | Correct | 8 ms | 1016 KB | Output is correct |
3 | Correct | 13 ms | 1532 KB | Output is correct |
4 | Correct | 23 ms | 2296 KB | Output is correct |
5 | Correct | 95 ms | 3424 KB | Output is correct |
6 | Correct | 45 ms | 3576 KB | Output is correct |
7 | Correct | 49 ms | 4084 KB | Output is correct |
8 | Correct | 45 ms | 3576 KB | Output is correct |
9 | Correct | 74 ms | 3764 KB | Output is correct |
10 | Correct | 45 ms | 3576 KB | Output is correct |
11 | Correct | 34 ms | 5240 KB | Output is correct |
12 | Correct | 32 ms | 2296 KB | Output is correct |
13 | Correct | 20 ms | 1656 KB | Output is correct |
14 | Correct | 44 ms | 6264 KB | Output is correct |
15 | Correct | 21 ms | 1272 KB | Output is correct |