# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
743331 | kxd | Nicelines (RMI20_nicelines) | C++17 | 0 ms | 0 KiB |
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 int long long
#define ll long long
#define ld long double
#define pb push_back
#define p_q priority_queue
#define m_p make_pair
#define pii pair<int,int>
#define endl '\n'
#define INIT ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define FOR(i, a, b) for(int i = a; i <= b; i++)
#define forn(i, n) for (int i = 0; i < n; i++)
#define forn1(i, n) for (int i = 1; i <= n; i++)
#define all(x) x.begin(),x.end()
#define ft first
#define sd second
using namespace std;
void solve(int subtask_id, int N) {
if(subtask_id != 1){
the_lines_are({1},{0});
return;
}
ld s = -1e12;
ld e = 1e12;
forn(i,100){
ld mid = (s+e)/2;
ld mid2 = (s+e)/2+0.000001;
if(query(0,mid) > query(0,mid2)) s = mid;
else e = mid2;
}
ld s2 = s;
s = 1e12;
e = -1e12;
forn(i,100){
ld mid = (s+e)/2;
ld mid2 = (s+e)/2+0.000001;
if(query(1,mid) > query(1,mid2)) s = mid;
else s = mid2;
}
int a = (int)round(s-s2);
int b = (int)round(s2);
the_lines_are({a}, {b});
}