Submission #828496

#TimeUsernameProblemLanguageResultExecution timeMemory
828496rainboyNicelines (RMI20_nicelines)C11
0 / 100
126 ms1052 KiB
#include "nice_lines_c.h" #define N 100 #define M 10000 #define X 1000000 #define Y ((long long) M * X + M + 1) typedef long double ld; int aa[N], bb[N], n; void solve_(ld ul, ld vl, ld ur, ld vr) { ld z1, z2, u, v; long long y, a, b; y = (vr - vl) / (ul - ur) + 0.5; z1 = query(X, y), z2 = query(X, y + 1); u = z2 - z1, v = z1 - u * y; if (u == ul && v == vl || u == ur && v == vr) { a = y / X, b = y - a * X; while (b < -M) a--, b += X; while (b > M) a++, b -= X; aa[n] = a, bb[n] = b, n++; return; } solve_(ul, vl, u, v), solve_(u, v, ur, vr); } void solve(int subtask_id, int n_) { ld ul, vl, ur, vr, z1, z2; z1 = query(X, -Y - 1), z2 = query(X, -Y); ul = z2 - z1, vl = z2 - ul * -Y; z1 = query(X, Y), z2 = query(X, Y + 1); ur = z2 - z1, vr = z1 - ur * Y; n = 0, solve_(ul, vl, ur, vr); the_lines_are(aa, bb); }

Compilation message (stderr)

nicelines.c: In function 'solve_':
nicelines.c:19:14: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
   19 |  if (u == ul && v == vl || u == ur && v == vr) {
      |      ~~~~~~~~^~~~~~~~~~
#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...