# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
748162 |
2023-05-25T13:28:00 Z |
Sharky |
JOIOJI (JOI14_joioji) |
C++17 |
|
40 ms |
6224 KB |
#include <bits/stdc++.h>
using namespace std;
map<pair<int, int>, int> mp;
int32_t main() {
ios::sync_with_stdio(0); cin.tie(0);
int n, ans = 0;
string s;
cin >> n >> s;
vector<int> cnt(3, 0);
map<char, int> cv = {{'J', 0}, {'O', 1}, {'I', 2}};
mp[{0, 0}] = -1;
for (int i = 0; i < n; i++) {
cnt[cv[s[i]]]++;
pair<int, int> tmp = {cnt[1] - cnt[0], cnt[2] - cnt[1]};
if (!mp.count(tmp)) mp[tmp] = i;
else ans = max(ans, i - mp[tmp]);
}
cout << ans << '\n';
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
324 KB |
Output is correct |
9 |
Correct |
1 ms |
324 KB |
Output is correct |
10 |
Correct |
1 ms |
324 KB |
Output is correct |
11 |
Correct |
1 ms |
212 KB |
Output is correct |
12 |
Correct |
1 ms |
328 KB |
Output is correct |
13 |
Correct |
0 ms |
320 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
320 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
4 |
Correct |
1 ms |
340 KB |
Output is correct |
5 |
Correct |
1 ms |
340 KB |
Output is correct |
6 |
Correct |
1 ms |
340 KB |
Output is correct |
7 |
Correct |
1 ms |
340 KB |
Output is correct |
8 |
Correct |
1 ms |
340 KB |
Output is correct |
9 |
Correct |
1 ms |
452 KB |
Output is correct |
10 |
Correct |
1 ms |
340 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
468 KB |
Output is correct |
2 |
Correct |
6 ms |
980 KB |
Output is correct |
3 |
Correct |
10 ms |
1396 KB |
Output is correct |
4 |
Correct |
19 ms |
2188 KB |
Output is correct |
5 |
Correct |
28 ms |
3384 KB |
Output is correct |
6 |
Correct |
37 ms |
3620 KB |
Output is correct |
7 |
Correct |
37 ms |
4048 KB |
Output is correct |
8 |
Correct |
35 ms |
3460 KB |
Output is correct |
9 |
Correct |
40 ms |
3768 KB |
Output is correct |
10 |
Correct |
38 ms |
3528 KB |
Output is correct |
11 |
Correct |
27 ms |
5120 KB |
Output is correct |
12 |
Correct |
20 ms |
2264 KB |
Output is correct |
13 |
Correct |
19 ms |
1632 KB |
Output is correct |
14 |
Correct |
31 ms |
6224 KB |
Output is correct |
15 |
Correct |
25 ms |
1236 KB |
Output is correct |