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 "nice_lines_c.h"
#define N 100
#define M 10000
#define X (M * 2 + 1)
#define Y ((long long) M * X + M + 1)
typedef long double ld;
void solve(int subtask_id, int n) {
static int aa[N], bb[N];
long long y, y_, lower, upper, a, b;
ld z, z1, z2;
int i;
y_ = -Y, z1 = query(X, y_), z2 = query(X, y_ + 1);
for (i = 0; i < n; i++) {
lower = y_, upper = Y + 1;
while (upper - lower > 1) {
y = (lower + upper) / 2;
z = query(X, y);
if (z - z1 == (z2 - z1) * (y - y_))
lower = y;
else
upper = y;
}
y_ = lower, z1 = query(X, y_), z2 = query(X, y_ + 1);
a = lower / X, b = y_ - a * X;
while (b > M)
a++, b -= X;
while (b < -M)
a--, b += X;
aa[i] = a, bb[i] = b;
}
the_lines_are(aa, bb);
}
# | 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... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |