Submission #380230

# Submission time Handle Problem Language Result Execution time Memory
380230 2021-03-20T15:57:19 Z rainboy Koala Game (APIO17_koala) C
56 / 100
18 ms 492 KB
#include "koala.h"
#include <string.h>

#define N	100

int minValue(int n, int w) {
	static int bb[N], rr[N];
	int i;

	memset(bb, 0, n * sizeof *bb), bb[0] = 1;
	playRound(bb, rr);
	for (i = 1; i < n; i++)
		if (rr[i] == 0)
			return i;
	return 0;
}

int aa[][3] = { { 2, 4, 11 }, { 2, 4, 6 }, { 2, 4, 0 }, { 2, 0, 0 }, { 0, 0, 0 } };

int kk[] = { 3, 3, 2, 1, 0 };
char used[N];

int maxValue(int n, int w) {
	static int bb[N], rr[N];
	int g, i, r, cnt;

	if (n >= 44)
		g = 0;
	else if (n >= 20)
		g = 1;
	else if (n >= 8)
		g = 2;
	else if (n >= 4)
		g = 3;
	else if (n >= 2)
		g = 4;
	else {
		for (i = 0; i < N; i++)
			if (!used[i])
				return i;
		return -1;
	}
	for (i = 0; i < N; i++)
		bb[i] = !used[i];
	playRound(bb, rr);
	for (r = 0; r < kk[g]; r++) {
		for (i = 0; i < N; i++)
			if (bb[i] && rr[i])
				bb[i] = aa[g][r];
			else
				bb[i] = 0;
		playRound(bb, rr);
	}
	cnt = 0;
	for (i = 0; i < N; i++)
		if (bb[i] && rr[i])
			cnt++;
	for (i = 0; i < N; i++)
		if (bb[i] && rr[i])
			return i;
	return -1;
}

int greaterValue(int n, int w) {
	// TODO: Implement Subtask 3 solution here.
	// You may leave this function unmodified if you are not attempting this
	// subtask.
	return 0;
}

void allValues(int n, int w, int *pp) {
	if (w == 2*n) {
		// TODO: Implement Subtask 4 solution here.
		// You may leave this block unmodified if you are not attempting this
		// subtask.
	} else {
		int p;

		for (p = n; p >= 1; p--) {
			int i = maxValue(p, p);

			used[i] = 1, pp[i] = p;
		}
	}
}
# Verdict Execution time Memory Grader output
1 Correct 6 ms 364 KB Output is correct
2 Correct 5 ms 364 KB Output is correct
3 Correct 5 ms 364 KB Output is correct
4 Correct 5 ms 364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 18 ms 364 KB Output is correct
2 Correct 18 ms 364 KB Output is correct
3 Correct 18 ms 364 KB Output is correct
4 Correct 18 ms 364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Partially correct 16 ms 364 KB Output is partially correct
2 Partially correct 15 ms 364 KB Output is partially correct
3 Partially correct 15 ms 364 KB Output is partially correct
4 Partially correct 15 ms 364 KB Output is partially correct
5 Partially correct 16 ms 492 KB Output is partially correct
6 Partially correct 17 ms 364 KB Output is partially correct
7 Partially correct 16 ms 492 KB Output is partially correct
8 Partially correct 15 ms 364 KB Output is partially correct
9 Partially correct 15 ms 364 KB Output is partially correct
10 Partially correct 15 ms 364 KB Output is partially correct
11 Partially correct 16 ms 364 KB Output is partially correct
12 Partially correct 15 ms 364 KB Output is partially correct
13 Partially correct 16 ms 364 KB Output is partially correct
14 Partially correct 15 ms 364 KB Output is partially correct
15 Partially correct 16 ms 364 KB Output is partially correct
16 Partially correct 16 ms 364 KB Output is partially correct
17 Partially correct 16 ms 364 KB Output is partially correct
18 Partially correct 15 ms 364 KB Output is partially correct
19 Partially correct 16 ms 364 KB Output is partially correct
20 Partially correct 18 ms 492 KB Output is partially correct
21 Partially correct 16 ms 364 KB Output is partially correct
22 Partially correct 16 ms 364 KB Output is partially correct
23 Partially correct 15 ms 364 KB Output is partially correct
24 Partially correct 16 ms 492 KB Output is partially correct
25 Partially correct 16 ms 364 KB Output is partially correct
26 Partially correct 15 ms 364 KB Output is partially correct
27 Partially correct 17 ms 364 KB Output is partially correct
28 Partially correct 16 ms 364 KB Output is partially correct
29 Partially correct 16 ms 364 KB Output is partially correct
30 Partially correct 16 ms 384 KB Output is partially correct
31 Partially correct 16 ms 364 KB Output is partially correct
32 Partially correct 16 ms 364 KB Output is partially correct
33 Partially correct 15 ms 364 KB Output is partially correct
34 Partially correct 16 ms 364 KB Output is partially correct
35 Partially correct 17 ms 364 KB Output is partially correct
36 Partially correct 16 ms 364 KB Output is partially correct
37 Partially correct 16 ms 364 KB Output is partially correct
38 Partially correct 15 ms 364 KB Output is partially correct
39 Partially correct 16 ms 364 KB Output is partially correct
40 Partially correct 15 ms 364 KB Output is partially correct