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 <stdio.h>
#include<bits/stdc++.h>
#define ff first
#define ss second
#define all(x) x.begin(), x.end()
using namespace std;
using ll = long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
template<typename t>
using matrix = vector<vector<t>>;
#include "nice_lines.h"
const long double EPS = 1e-10;
void solve(int subtask_id, int N) {
if(N > 1) return;
int ini = -1e4, fim = 1e4;
while(ini!=fim){
int m = (ini+fim+1)>>1;
long double q1 = query(0,m-1), q2 = query(0,m);
if(q2 <= q1)
ini = m;
else fim = m-1;
}
int y = ini;
long double l = -1e4, r = 1e4;
while(r-l > EPS){
long double m1 = (r-l)/3+l;
long double m2 = 2*(r-l)/3+l;
if(query(m2,0) <= query(m1,0))
l = m1;
else r = m2;
}
// x = -b/a <=> a = -b/x
int a = round(-y/l);
the_lines_are({a}, {y});
}
# | 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... |