# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
20884 | 2017-03-04T15:48:01 Z | 14kg | 동전 게임 (KOI15_coin) | C++11 | 39 ms | 1116 KB |
#include <stdio.h> #define max2(x,y) (x>y?x:y) int n; bool f(int x, int y, int mx) { int turn = n - max2(x, y); if (x + turn - mx < y) return false; if (y + turn + mx < x) return false; return true; } int main() { int k, x, y; bool check; scanf("%d %d", &n, &k); while (k--) { scanf("%d %d", &x, &y), check = false; if (x > 0 && f(x - 1, y, 0)) check = true; if (y > 0 && f(x, y - 1, 1)) check = true; if (x + y == 0) check = true; printf("%d\n", check); } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 1116 KB | Output is correct |
2 | Correct | 0 ms | 1116 KB | Output is correct |
3 | Correct | 0 ms | 1116 KB | Output is correct |
4 | Correct | 0 ms | 1116 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 1116 KB | Output is correct |
2 | Correct | 0 ms | 1116 KB | Output is correct |
3 | Correct | 0 ms | 1116 KB | Output is correct |
4 | Correct | 0 ms | 1116 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 1116 KB | Output is correct |
2 | Correct | 0 ms | 1116 KB | Output is correct |
3 | Correct | 3 ms | 1116 KB | Output is correct |
4 | Correct | 26 ms | 1116 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 1116 KB | Output is correct |
2 | Correct | 0 ms | 1116 KB | Output is correct |
3 | Correct | 19 ms | 1116 KB | Output is correct |
4 | Correct | 19 ms | 1116 KB | Output is correct |
5 | Correct | 36 ms | 1116 KB | Output is correct |
6 | Correct | 39 ms | 1116 KB | Output is correct |
7 | Correct | 23 ms | 1116 KB | Output is correct |
8 | Correct | 39 ms | 1116 KB | Output is correct |