Submission #490087

# Submission time Handle Problem Language Result Execution time Memory
490087 2021-11-25T13:33:07 Z rainboy Pick (COI18_pick) C
100 / 100
1 ms 336 KB
#include <stdio.h>

int dx[] = { 1, -1, 0, 0, 1, -1, -1, 1 };
int dy[] = { 0, 0, 1, -1, 1, -1, 1, -1 };

int x, y;

void move(int t) {
	printf("%d %d\n", x, y), x += dx[t], y += dy[t];
}

int main() {
	static int kk[4];
	int t, i;

	for (t = 0; t < 4; t++)
		scanf("%d", &kk[t]);
	if (kk[0] == 0 && kk[1] == 0) {
		for (i = 0; i < kk[2] / 2; i++)
			move(2 << 1 | 0);
		move(3 << 1 | 0);
		for (i = 0; i < kk[2] / 2 - 1; i++)
			move(2 << 1 | 1);
		for (i = 0; i < kk[3] / 2 - 1; i++)
			move(3 << 1 | 0);
		move(2 << 1 | 1);
		for (i = 0; i < kk[3] / 2; i++)
			move(3 << 1 | 1);
	} else if (kk[0] == 0) {
		if (kk[2] % 2 == 1 && kk[3] % 2 == 1) {
			move(2 << 1 | 1);
			for (i = 0; i < kk[1] / 2 - 1; i++)
				move(1 << 1 | 1);
			move(3 << 1 | 1);
			for (i = 0; i < kk[1] / 2; i++)
				move(1 << 1 | 0);
			kk[2]--, kk[3]--;
		} else if (kk[2] >= 2) {
			move(2 << 1 | 1);
			for (i = 0; i < kk[1] / 2; i++)
				move(1 << 1 | 1);
			move(2 << 1 | 0);
			for (i = 0; i < kk[1] / 2 - 1; i++)
				move(1 << 1 | 0);
			kk[2] -= 2;
		} else {
			move(3 << 1 | 1);
			for (i = 0; i < kk[1] / 2; i++)
				move(1 << 1 | 1);
			move(3 << 1 | 0);
			for (i = 0; i < kk[1] / 2 - 1; i++)
				move(1 << 1 | 0);
			kk[3] -= 2;
		}
		for (i = 0; i < kk[2] / 2; i++)
			move(2 << 1 | 0);
		for (i = 0; i < kk[3] / 2; i++)
			move(3 << 1 | 1);
		move(1 << 1 | 0);
		for (i = 0; i < kk[3] / 2; i++)
			move(3 << 1 | 0);
		for (i = 0; i < kk[2] / 2; i++)
			move(2 << 1 | 1);
	} else {
		if (kk[2] % 2 == 1 && kk[3] % 2 == 1) {
			move(2 << 1 | 1);
			for (i = 0; i < kk[0] / 2 - 1; i++)
				move(0 << 1 | 1);
			move(3 << 1 | 0);
			for (i = 0; i < kk[0] / 2; i++)
				move(0 << 1 | 0);
			kk[2]--, kk[3]--;
		} else if (kk[2] % 2 == 1) {
			move(2 << 1 | 1);
			for (i = 0; i < kk[0] / 2; i++)
				move(0 << 1 | 1);
			move(1 << 1 | 0);
			for (i = 0; i < kk[0] / 2; i++)
				move(0 << 1 | 0);
			kk[2]--, kk[1]--;
		} else if (kk[3] % 2 == 1) {
			move(1 << 1 | 1);
			for (i = 0; i < kk[0] / 2; i++)
				move(0 << 1 | 1);
			move(3 << 1 | 0);
			for (i = 0; i < kk[0] / 2; i++)
				move(0 << 1 | 0);
			kk[1]--, kk[3]--;
		} else if (kk[2] >= 2) {
			move(2 << 1 | 1);
			for (i = 0; i < kk[0] / 2; i++)
				move(0 << 1 | 1);
			move(2 << 1 | 0);
			for (i = 0; i < kk[0] / 2 - 1; i++)
				move(0 << 1 | 0);
			kk[2] -= 2;
		} else if (kk[3] >= 2) {
			move(3 << 1 | 1);
			for (i = 0; i < kk[0] / 2; i++)
				move(0 << 1 | 1);
			move(3 << 1 | 0);
			for (i = 0; i < kk[0] / 2 - 1; i++)
				move(0 << 1 | 0);
			kk[3] -= 2;
		} else {
			move(1 << 1 | 1);
			for (i = 0; i < kk[0] / 2; i++)
				move(0 << 1 | 1);
			move(1 << 1 | 0);
			for (i = 0; i < kk[0] / 2 - 1; i++)
				move(0 << 1 | 0);
			kk[1] -= 2;
		}
		for (i = 0; i < kk[1] / 2; i++)
			move(1 << 1 | 0);
		for (i = 0; i < kk[2] / 2; i++)
			move(2 << 1 | 0);
		for (i = 0; i < kk[3] / 2; i++)
			move(3 << 1 | 0);
		move(0 << 1 | 0);
		for (i = 0; i < kk[3] / 2; i++)
			move(3 << 1 | 1);
		for (i = 0; i < kk[2] / 2; i++)
			move(2 << 1 | 1);
		for (i = 0; i < kk[1] / 2; i++)
			move(1 << 1 | 1);
	}
	return 0;
}

Compilation message

pick.c: In function 'main':
pick.c:17:3: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   17 |   scanf("%d", &kk[t]);
      |   ^~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 208 KB Output is correct
4 Correct 0 ms 280 KB Output is correct
5 Correct 0 ms 208 KB Output is correct
6 Correct 0 ms 208 KB Output is correct
7 Correct 0 ms 208 KB Output is correct
8 Correct 0 ms 208 KB Output is correct
9 Correct 0 ms 208 KB Output is correct
10 Correct 0 ms 208 KB Output is correct
11 Correct 1 ms 208 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 208 KB Output is correct
4 Correct 0 ms 280 KB Output is correct
5 Correct 0 ms 208 KB Output is correct
6 Correct 0 ms 208 KB Output is correct
7 Correct 0 ms 208 KB Output is correct
8 Correct 0 ms 208 KB Output is correct
9 Correct 0 ms 208 KB Output is correct
10 Correct 0 ms 208 KB Output is correct
11 Correct 1 ms 208 KB Output is correct
12 Correct 0 ms 208 KB Output is correct
13 Correct 1 ms 208 KB Output is correct
14 Correct 0 ms 208 KB Output is correct
15 Correct 0 ms 208 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 208 KB Output is correct
4 Correct 0 ms 280 KB Output is correct
5 Correct 0 ms 208 KB Output is correct
6 Correct 0 ms 208 KB Output is correct
7 Correct 0 ms 208 KB Output is correct
8 Correct 0 ms 208 KB Output is correct
9 Correct 0 ms 208 KB Output is correct
10 Correct 0 ms 208 KB Output is correct
11 Correct 1 ms 208 KB Output is correct
12 Correct 0 ms 208 KB Output is correct
13 Correct 1 ms 208 KB Output is correct
14 Correct 0 ms 208 KB Output is correct
15 Correct 0 ms 208 KB Output is correct
16 Correct 0 ms 208 KB Output is correct
17 Correct 0 ms 208 KB Output is correct
18 Correct 0 ms 208 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 208 KB Output is correct
4 Correct 0 ms 280 KB Output is correct
5 Correct 0 ms 208 KB Output is correct
6 Correct 0 ms 208 KB Output is correct
7 Correct 0 ms 208 KB Output is correct
8 Correct 0 ms 208 KB Output is correct
9 Correct 0 ms 208 KB Output is correct
10 Correct 0 ms 208 KB Output is correct
11 Correct 1 ms 208 KB Output is correct
12 Correct 0 ms 208 KB Output is correct
13 Correct 1 ms 208 KB Output is correct
14 Correct 0 ms 208 KB Output is correct
15 Correct 0 ms 208 KB Output is correct
16 Correct 0 ms 208 KB Output is correct
17 Correct 0 ms 208 KB Output is correct
18 Correct 0 ms 208 KB Output is correct
19 Correct 0 ms 208 KB Output is correct
20 Correct 0 ms 208 KB Output is correct
21 Correct 0 ms 208 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 208 KB Output is correct
4 Correct 0 ms 280 KB Output is correct
5 Correct 0 ms 208 KB Output is correct
6 Correct 0 ms 208 KB Output is correct
7 Correct 0 ms 208 KB Output is correct
8 Correct 0 ms 208 KB Output is correct
9 Correct 0 ms 208 KB Output is correct
10 Correct 0 ms 208 KB Output is correct
11 Correct 1 ms 208 KB Output is correct
12 Correct 0 ms 208 KB Output is correct
13 Correct 1 ms 208 KB Output is correct
14 Correct 0 ms 208 KB Output is correct
15 Correct 0 ms 208 KB Output is correct
16 Correct 0 ms 208 KB Output is correct
17 Correct 0 ms 208 KB Output is correct
18 Correct 0 ms 208 KB Output is correct
19 Correct 0 ms 208 KB Output is correct
20 Correct 0 ms 208 KB Output is correct
21 Correct 0 ms 208 KB Output is correct
22 Correct 0 ms 208 KB Output is correct
23 Correct 0 ms 208 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 0 ms 204 KB Output is correct
10 Correct 0 ms 204 KB Output is correct
11 Correct 0 ms 208 KB Output is correct
12 Correct 0 ms 280 KB Output is correct
13 Correct 0 ms 208 KB Output is correct
14 Correct 0 ms 208 KB Output is correct
15 Correct 0 ms 208 KB Output is correct
16 Correct 0 ms 208 KB Output is correct
17 Correct 0 ms 208 KB Output is correct
18 Correct 0 ms 208 KB Output is correct
19 Correct 1 ms 208 KB Output is correct
20 Correct 0 ms 208 KB Output is correct
21 Correct 1 ms 208 KB Output is correct
22 Correct 0 ms 208 KB Output is correct
23 Correct 0 ms 208 KB Output is correct
24 Correct 0 ms 208 KB Output is correct
25 Correct 0 ms 208 KB Output is correct
26 Correct 0 ms 208 KB Output is correct
27 Correct 0 ms 208 KB Output is correct
28 Correct 0 ms 208 KB Output is correct
29 Correct 0 ms 208 KB Output is correct
30 Correct 0 ms 208 KB Output is correct
31 Correct 0 ms 208 KB Output is correct
32 Correct 0 ms 208 KB Output is correct
33 Correct 1 ms 208 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 0 ms 204 KB Output is correct
10 Correct 0 ms 204 KB Output is correct
11 Correct 0 ms 208 KB Output is correct
12 Correct 0 ms 280 KB Output is correct
13 Correct 0 ms 208 KB Output is correct
14 Correct 0 ms 208 KB Output is correct
15 Correct 0 ms 208 KB Output is correct
16 Correct 0 ms 208 KB Output is correct
17 Correct 0 ms 208 KB Output is correct
18 Correct 0 ms 208 KB Output is correct
19 Correct 1 ms 208 KB Output is correct
20 Correct 0 ms 208 KB Output is correct
21 Correct 1 ms 208 KB Output is correct
22 Correct 0 ms 208 KB Output is correct
23 Correct 0 ms 208 KB Output is correct
24 Correct 0 ms 208 KB Output is correct
25 Correct 0 ms 208 KB Output is correct
26 Correct 0 ms 208 KB Output is correct
27 Correct 0 ms 208 KB Output is correct
28 Correct 0 ms 208 KB Output is correct
29 Correct 0 ms 208 KB Output is correct
30 Correct 0 ms 208 KB Output is correct
31 Correct 0 ms 208 KB Output is correct
32 Correct 0 ms 208 KB Output is correct
33 Correct 1 ms 208 KB Output is correct
34 Correct 1 ms 336 KB Output is correct
35 Correct 1 ms 336 KB Output is correct
36 Correct 0 ms 208 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 0 ms 204 KB Output is correct
10 Correct 0 ms 204 KB Output is correct
11 Correct 0 ms 208 KB Output is correct
12 Correct 0 ms 280 KB Output is correct
13 Correct 0 ms 208 KB Output is correct
14 Correct 0 ms 208 KB Output is correct
15 Correct 0 ms 208 KB Output is correct
16 Correct 0 ms 208 KB Output is correct
17 Correct 0 ms 208 KB Output is correct
18 Correct 0 ms 208 KB Output is correct
19 Correct 1 ms 208 KB Output is correct
20 Correct 0 ms 208 KB Output is correct
21 Correct 1 ms 208 KB Output is correct
22 Correct 0 ms 208 KB Output is correct
23 Correct 0 ms 208 KB Output is correct
24 Correct 0 ms 208 KB Output is correct
25 Correct 0 ms 208 KB Output is correct
26 Correct 0 ms 208 KB Output is correct
27 Correct 0 ms 208 KB Output is correct
28 Correct 0 ms 208 KB Output is correct
29 Correct 0 ms 208 KB Output is correct
30 Correct 0 ms 208 KB Output is correct
31 Correct 0 ms 208 KB Output is correct
32 Correct 0 ms 208 KB Output is correct
33 Correct 1 ms 208 KB Output is correct
34 Correct 1 ms 336 KB Output is correct
35 Correct 1 ms 336 KB Output is correct
36 Correct 0 ms 208 KB Output is correct
37 Correct 0 ms 276 KB Output is correct
38 Correct 0 ms 208 KB Output is correct
39 Correct 0 ms 288 KB Output is correct
40 Correct 0 ms 208 KB Output is correct
41 Correct 0 ms 208 KB Output is correct
42 Correct 1 ms 208 KB Output is correct
43 Correct 0 ms 208 KB Output is correct