# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
998301 |
2024-06-13T14:48:11 Z |
abczz |
JOIOJI (JOI14_joioji) |
C++17 |
|
34 ms |
6124 KB |
#include <iostream>
#include <array>
#include <algorithm>
#include <map>
#define ll long long
using namespace std;
ll n, f;
map <array<ll, 2>, ll> mp;
array <ll, 2> cur;
string S;
int main() {
cin >> n >> S;
mp[cur] = -1;
for (int i=0; i<n; ++i) {
if (S[i] == 'J') --cur[0], --cur[1];
else if (S[i] == 'O') ++cur[0];
else ++cur[1];
if (mp.find(cur) == mp.end()) mp[cur] = i;
else {
f = max(f, i-mp[cur]);
}
}
cout << f << '\n';
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
432 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
1 ms |
348 KB |
Output is correct |
12 |
Correct |
0 ms |
348 KB |
Output is correct |
13 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
436 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
1 ms |
348 KB |
Output is correct |
8 |
Correct |
1 ms |
436 KB |
Output is correct |
9 |
Correct |
1 ms |
348 KB |
Output is correct |
10 |
Correct |
1 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
604 KB |
Output is correct |
2 |
Correct |
5 ms |
1036 KB |
Output is correct |
3 |
Correct |
8 ms |
1368 KB |
Output is correct |
4 |
Correct |
16 ms |
2392 KB |
Output is correct |
5 |
Correct |
24 ms |
3564 KB |
Output is correct |
6 |
Correct |
30 ms |
3564 KB |
Output is correct |
7 |
Correct |
32 ms |
4064 KB |
Output is correct |
8 |
Correct |
29 ms |
3564 KB |
Output is correct |
9 |
Correct |
34 ms |
3828 KB |
Output is correct |
10 |
Correct |
29 ms |
3564 KB |
Output is correct |
11 |
Correct |
24 ms |
5188 KB |
Output is correct |
12 |
Correct |
17 ms |
2536 KB |
Output is correct |
13 |
Correct |
18 ms |
1768 KB |
Output is correct |
14 |
Correct |
24 ms |
6124 KB |
Output is correct |
15 |
Correct |
16 ms |
1352 KB |
Output is correct |