Submission #536536

# Submission time Handle Problem Language Result Execution time Memory
536536 2022-03-13T13:39:22 Z rainboy JOIOJI (JOI14_joioji) C
5 / 100
10 ms 340 KB
#include <stdio.h>

#define N	200

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 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 292 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 292 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 0 ms 284 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 288 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 212 KB Output is correct
2 Runtime error 10 ms 284 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 340 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -