# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
536539 |
2022-03-13T13:40:16 Z |
rainboy |
JOIOJI (JOI14_joioji) |
C |
|
284 ms |
272 KB |
#include <stdio.h>
#define N 4000
int max(int a, int b) { return a > b ? a : b; }
int main() {
static char cc[N + 1];
int n, i, j, kj, ko, ki, l;
scanf("%d%s", &n, cc);
l = 0;
for (i = 0; i < n; i++) {
kj = ko = ki = 0;
for (j = i; j < n; j++) {
if (cc[j] == 'J')
kj++;
else if (cc[j] == 'O')
ko++;
else
ki++;
if (kj == ki && ko == ki)
l = max(l, j - i + 1);
}
}
printf("%d\n", l);
return 0;
}
Compilation message
joioji.c: In function 'main':
joioji.c:11:2: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
11 | scanf("%d%s", &n, cc);
| ^~~~~~~~~~~~~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
0 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 |
0 ms |
212 KB |
Output is correct |
8 |
Correct |
0 ms |
212 KB |
Output is correct |
9 |
Correct |
0 ms |
212 KB |
Output is correct |
10 |
Correct |
1 ms |
212 KB |
Output is correct |
11 |
Correct |
0 ms |
212 KB |
Output is correct |
12 |
Correct |
1 ms |
212 KB |
Output is correct |
13 |
Correct |
1 ms |
212 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
212 KB |
Output is correct |
2 |
Correct |
9 ms |
212 KB |
Output is correct |
3 |
Correct |
19 ms |
212 KB |
Output is correct |
4 |
Correct |
45 ms |
264 KB |
Output is correct |
5 |
Correct |
39 ms |
272 KB |
Output is correct |
6 |
Correct |
24 ms |
212 KB |
Output is correct |
7 |
Correct |
27 ms |
272 KB |
Output is correct |
8 |
Correct |
33 ms |
212 KB |
Output is correct |
9 |
Correct |
33 ms |
212 KB |
Output is correct |
10 |
Correct |
37 ms |
268 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
284 ms |
260 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |