# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
20884 | 14kg | 동전 게임 (KOI15_coin) | C++11 | 39 ms | 1116 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |