Submission #1056315

#TimeUsernameProblemLanguageResultExecution timeMemory
1056315rainboyBring Down the Grading Server (CEOI23_gradingserver)C11
10 / 100
72 ms1228 KiB
#include <stdio.h> long long min(long long a, long long b) { return a < b ? a : b; } long long max(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; if (x1 + y1 * c <= 0) return 0; if (x2 + y2 * c <= 0) return 1; if (x1 <= 0) { if (x2 > 0) { if (x2 >= c) return 0; if (y2 > 0) { if (x2 - x1 >= c) return 0; return !solve(x2, y2, x1 + c, y1 - 1); } y = -x1 / (c - x2) + 1; return y <= y1 && solve(x1 + y * (c - x2), y1 - y, x2, y2); } 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 && x1 + y1 * (c - x2) >= c) return 1; if (!solve(x2 - x1, y2, x1, y1)) return 1; if (x2 >= c || y2 >= c) return 0; y = y2 == 0 ? 1 : max((x2 + c * (y2 - 1)) / (y2 + 1) + 1 - x1, 0) / (c - x2) + 1; return y <= y1 && solve(x1 + y * (c - x2), y1 - y, x2, y2); } 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 (stderr)

gradingserver.c: In function 'main':
gradingserver.c:46:2: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   46 |  scanf("%d%d", &c, &t);
      |  ^~~~~~~~~~~~~~~~~~~~~
gradingserver.c:50:3: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   50 |   scanf("%lld%lld%lld%lld", &x1, &y2, &x2, &y1), x1 -= y1 * c, x2 -= y2 * c;
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...