# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1049395 | 2024-08-08T17:57:08 Z | rainboy | Bring Down the Grading Server (CEOI23_gradingserver) | C | 96 ms | 1108 KB |
#include <stdio.h> long long min(long long a, long long b) { return a < b ? a : b; } int c; int solve(long long x1, long long y1, long long x2, long long y2) { long long y; int turn; if (x1 + y1 * c <= 0) return 0; if (x2 + y2 * c <= 0) return 1; if (x1 <= 0) { if (x2 > 0) return !solve(x2, y2, x1 + c, y1 - 1); else { y = min(-x1 / c + 1, -x2 / c + 1); return solve(x1 + y * c, y1 - y, x2 + y * c, y2 - y); } } if (x1 >= x2 && (x1 >= c || y1 > 0)) return 1; if (x2 >= c && !solve(x2 - x1, y2, x1, y1)) return 1; if (y1 > 0 && x2 < c) x1 += y1 * (c - x2); if (y2 > 0 && x1 < c) x2 += y2 * (c - x1); turn = 1; while (x1 > 0 && x2 > 0) { if (turn == 1) x2 -= x1; else x1 -= x2; turn ^= 3; } return x2 <= 0; } int main() { int t; scanf("%d%d", &c, &t); while (t--) { long long x1, y1, x2, y2; scanf("%lld%lld%lld%lld", &x1, &y2, &x2, &y1), x1 -= y1 * c, x2 -= y2 * c; printf(solve(x1, y1, x2, y2) ? "YES\n" : "NO\n"); } return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Incorrect | 43 ms | 1048 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Incorrect | 43 ms | 1048 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 75 ms | 1032 KB | Output is correct |
2 | Correct | 96 ms | 1108 KB | Output is correct |
3 | Correct | 81 ms | 1108 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Incorrect | 43 ms | 1048 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Incorrect | 43 ms | 1048 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Incorrect | 43 ms | 1048 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Incorrect | 43 ms | 1048 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |