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 <bits/stdc++.h>
#include "nice_lines.h"
using namespace std;
#define ll long long
#define ld long double
#define pii pair <int, int>
#define fi first
#define se second
#define mp make_pair
const ll LIM = 1e4, x0 = 2*LIM;
const ld EPS = 1e-9, inf = 1e18;
ll MAX_DEP = 40;
vector <int> va, vb;
set <pii> S;
void get(ld y){
int b = int(round(y+x0*LIM+LIM))%x0-LIM, a = int(round(y-b)/(ld)x0);
if (!S.count(mp(a, b))){
va.push_back(a);
vb.push_back(b);
S.insert(mp(a, b));
}
}
void dnc(int dep, ld l, ld r, ld fl, ld fr){
if (dep >= MAX_DEP){
get(l);
return;
}
ld mid = (l+r)/2.0;
if (fl == +inf) fl = query(x0, l);
if (fr == +inf) fr = query(x0, r);
ld fmid = query(x0, mid);
if (abs(2.0*fmid - (fl+fr)) <= EPS) return;
dnc(dep+1, l, mid, fl, fmid);
dnc(dep+1, mid, r, fmid, fr);
}
void solve(int subtask_id, int N){
while (true){
va.clear();
vb.clear();
S.clear();
dnc(0, -2*LIM*(x0+1), 2*LIM*(x0+1), +inf, +inf);
if ((int)va.size() >= N) break;
MAX_DEP--;
}
the_lines_are(va, vb);
}
# | 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... |