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.h"
#include <bits/stdc++.h>
#define ld long double
using namespace std;
const int x=1e5;
const ld eps=1e-9;
vector <int> a,b;
int n;
void dnc(ld l, ld r, ld lo, ld hi){
ld mid=(l+r)/2,m=query(x,mid);
if (ceil(l)>floor(r)||a.size()==n)
return;
if (abs((lo+hi)/2-m)<eps)
return;
if (r-l<1){
int y=floor(r);
int B=(y%x+x)%x;
if (B>10000)
B-=x;
int A=(y-B)/x;
a.push_back(A);
b.push_back(B);
return;
}
dnc(l,mid,lo,m);
dnc(mid,r,m,hi);
}
void solve(int subtask_id, int N){
n=N;
ld L=-1e9-1e4,R=1e9+1e4+1e-6;
dnc(L,R,query(x,L),query(x,R));
the_lines_are(a,b);
}
Compilation message (stderr)
nicelines.cpp: In function 'void dnc(long double, long double, long double, long double)':
nicelines.cpp:11:35: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
11 | if (ceil(l)>floor(r)||a.size()==n)
| ~~~~~~~~^~~
# | 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... |