# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
208384 |
2020-03-11T05:04:36 Z |
bensonlzl |
JOIOJI (JOI14_joioji) |
C++14 |
|
74 ms |
10276 KB |
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> pi;
map<pi,vector<int> > m;
int N, curJ = 0, curO = 0, curI = 0;
char x;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
cin >> N;
m[pi(0,0)] = vector<int>(1,0);
for (int i = 1; i <= N; ++i){
cin >> x;
if (x == 'J') curJ++;
else if (x == 'O') curO++;
else curI++;
if (m.find(pi(curO-curJ,curI-curO)) == m.end()){
m[pi(curO-curJ,curI-curO)] = vector<int>();
}
m[pi(curO-curJ,curI-curO)].push_back(i);
}
int maxi = 0;
for (auto it : m){
maxi = max(maxi,it.second.back()-it.second[0]);
}
cout << maxi << '\n';
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
376 KB |
Output is correct |
2 |
Correct |
5 ms |
376 KB |
Output is correct |
3 |
Correct |
5 ms |
376 KB |
Output is correct |
4 |
Correct |
5 ms |
376 KB |
Output is correct |
5 |
Correct |
5 ms |
376 KB |
Output is correct |
6 |
Correct |
5 ms |
376 KB |
Output is correct |
7 |
Correct |
5 ms |
376 KB |
Output is correct |
8 |
Correct |
5 ms |
376 KB |
Output is correct |
9 |
Correct |
5 ms |
376 KB |
Output is correct |
10 |
Correct |
5 ms |
376 KB |
Output is correct |
11 |
Correct |
5 ms |
376 KB |
Output is correct |
12 |
Correct |
5 ms |
376 KB |
Output is correct |
13 |
Correct |
5 ms |
376 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
376 KB |
Output is correct |
2 |
Correct |
5 ms |
376 KB |
Output is correct |
3 |
Correct |
6 ms |
504 KB |
Output is correct |
4 |
Correct |
6 ms |
504 KB |
Output is correct |
5 |
Correct |
6 ms |
504 KB |
Output is correct |
6 |
Correct |
5 ms |
376 KB |
Output is correct |
7 |
Correct |
6 ms |
504 KB |
Output is correct |
8 |
Correct |
5 ms |
508 KB |
Output is correct |
9 |
Correct |
6 ms |
504 KB |
Output is correct |
10 |
Correct |
6 ms |
504 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
7 ms |
632 KB |
Output is correct |
2 |
Correct |
15 ms |
1400 KB |
Output is correct |
3 |
Correct |
21 ms |
2296 KB |
Output is correct |
4 |
Correct |
38 ms |
3708 KB |
Output is correct |
5 |
Correct |
55 ms |
5752 KB |
Output is correct |
6 |
Correct |
68 ms |
6136 KB |
Output is correct |
7 |
Correct |
74 ms |
6904 KB |
Output is correct |
8 |
Correct |
67 ms |
5880 KB |
Output is correct |
9 |
Correct |
67 ms |
6392 KB |
Output is correct |
10 |
Correct |
64 ms |
6008 KB |
Output is correct |
11 |
Correct |
57 ms |
8568 KB |
Output is correct |
12 |
Correct |
43 ms |
3960 KB |
Output is correct |
13 |
Correct |
35 ms |
2936 KB |
Output is correct |
14 |
Correct |
65 ms |
10276 KB |
Output is correct |
15 |
Correct |
40 ms |
2552 KB |
Output is correct |