# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
18543 |
2016-02-08T10:28:38 Z |
choyi0521 |
JOIOJI (JOI14_joioji) |
C++14 |
|
33 ms |
6952 KB |
#include<stdio.h>
#include<algorithm>
#include<map>
using namespace std;
typedef long long ll;
int n,x,y,z,res;
char str[200001];
map<ll,int> mp;
int main(){
scanf("%d %s", &n, str);
mp[0] = -1;
for (int i = 0; i < n; i++) {
if (str[i] == 'J') x++;
else if (str[i] == 'O') y++;
else z++;
if (x&&y&&z) x--, y--, z--;
ll h = (ll)1e12*x + (ll)1e6*y + z;
auto it = mp.find(h);
if (it == mp.end()) mp[h]=i;
else res = max(res,i - it->second);
}
printf("%d", res);
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
1408 KB |
Output is correct |
2 |
Correct |
0 ms |
1408 KB |
Output is correct |
3 |
Correct |
0 ms |
1408 KB |
Output is correct |
4 |
Correct |
0 ms |
1408 KB |
Output is correct |
5 |
Correct |
0 ms |
1408 KB |
Output is correct |
6 |
Correct |
0 ms |
1408 KB |
Output is correct |
7 |
Correct |
0 ms |
1408 KB |
Output is correct |
8 |
Correct |
0 ms |
1408 KB |
Output is correct |
9 |
Correct |
0 ms |
1408 KB |
Output is correct |
10 |
Correct |
0 ms |
1408 KB |
Output is correct |
11 |
Correct |
0 ms |
1408 KB |
Output is correct |
12 |
Correct |
0 ms |
1408 KB |
Output is correct |
13 |
Correct |
0 ms |
1408 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
1408 KB |
Output is correct |
2 |
Correct |
0 ms |
1408 KB |
Output is correct |
3 |
Correct |
1 ms |
1408 KB |
Output is correct |
4 |
Correct |
1 ms |
1408 KB |
Output is correct |
5 |
Correct |
0 ms |
1408 KB |
Output is correct |
6 |
Correct |
0 ms |
1408 KB |
Output is correct |
7 |
Correct |
0 ms |
1408 KB |
Output is correct |
8 |
Correct |
0 ms |
1408 KB |
Output is correct |
9 |
Correct |
1 ms |
1408 KB |
Output is correct |
10 |
Correct |
0 ms |
1540 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
1540 KB |
Output is correct |
2 |
Correct |
3 ms |
1936 KB |
Output is correct |
3 |
Correct |
9 ms |
2332 KB |
Output is correct |
4 |
Correct |
16 ms |
3124 KB |
Output is correct |
5 |
Correct |
28 ms |
4180 KB |
Output is correct |
6 |
Correct |
32 ms |
4312 KB |
Output is correct |
7 |
Correct |
33 ms |
4708 KB |
Output is correct |
8 |
Correct |
29 ms |
4180 KB |
Output is correct |
9 |
Correct |
31 ms |
4444 KB |
Output is correct |
10 |
Correct |
33 ms |
4180 KB |
Output is correct |
11 |
Correct |
22 ms |
5896 KB |
Output is correct |
12 |
Correct |
15 ms |
2992 KB |
Output is correct |
13 |
Correct |
14 ms |
2332 KB |
Output is correct |
14 |
Correct |
27 ms |
6952 KB |
Output is correct |
15 |
Correct |
14 ms |
1936 KB |
Output is correct |