#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[0] / 2; i++)
move(0 << 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 | 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);
for (i = 0; i < kk[0] / 2; i++)
move(0 << 1 | 1);
} else {
if (kk[2] % 2 == 1 && kk[3] % 2 == 1) {
move(2 << 1 | 1);
for (i = 0; i < kk[1] / 2 - 1; i++)
move(0 << 1 | 1);
move(3 << 1 | 0);
for (i = 0; i < kk[1] / 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[1] / 2; i++)
move(0 << 1 | 1);
move(1 << 1 | 0);
for (i = 0; i < kk[1] / 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[1] / 2; i++)
move(0 << 1 | 1);
move(3 << 1 | 0);
for (i = 0; i < kk[1] / 2; i++)
move(0 << 1 | 0);
kk[1]--, kk[3]--;
} else if (kk[2] >= 2) {
move(2 << 1 | 1);
for (i = 0; i < kk[1] / 2; i++)
move(0 << 1 | 1);
move(2 << 1 | 0);
for (i = 0; i < kk[1] / 2 - 1; i++)
move(0 << 1 | 0);
kk[2] -= 2;
} else {
move(3 << 1 | 1);
for (i = 0; i < kk[1] / 2; i++)
move(0 << 1 | 1);
move(3 << 1 | 0);
for (i = 0; i < kk[1] / 2 - 1; i++)
move(0 << 1 | 0);
kk[3] -= 2;
}
for (i = 0; i < kk[0] / 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(1 << 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[0] / 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]);
| ^~~~~~~~~~~~~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
204 KB |
number of sticks is not consistent with the given input |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
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 |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Incorrect |
0 ms |
208 KB |
not a valid stick |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Incorrect |
0 ms |
208 KB |
not a valid stick |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Incorrect |
0 ms |
208 KB |
not a valid stick |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Incorrect |
0 ms |
208 KB |
not a valid stick |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Incorrect |
0 ms |
208 KB |
not a valid stick |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
204 KB |
number of sticks is not consistent with the given input |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
204 KB |
number of sticks is not consistent with the given input |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
204 KB |
number of sticks is not consistent with the given input |
2 |
Halted |
0 ms |
0 KB |
- |