# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
647005 | danikoynov | Nicelines (RMI20_nicelines) | C++14 | 61 ms | 288 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.
/**
____ ____ ____ ____ ____ ____
||l |||e |||i |||n |||a |||d ||
||__|||__|||__|||__|||__|||__||
|/__\|/__\|/__\|/__\|/__\|/__\|
**/
#include<bits/stdc++.h>
#define endl '\n'
#include "nice_lines.h"
using namespace std;
using namespace std;
typedef long long ll;
int maxcor = 1e4;
const long double eps = 1e-9;
vector < long long > cur;
long long x;
int _N;
void intersection_points()
{
long long base = -maxcor * maxcor;
while(cur.size() < _N)
{
ll lf = base, rf = maxcor * maxcor;
long double db = query(x, base);
while(rf - lf > 1)
{
ll mf = (lf + rf) / 2;
long double md = query(x, mf);
long double am = (long double)(base + mf) / 2.0;
long double df = query(x, am);
///cout << lf << " " << rf << " " << endl;
if (abs((df - db) - (md - df)) < eps)
lf = mf;
else
rf = mf - 1;
}
cur.push_back(lf);
base = lf + 1;
}
}
void solve(int subtask_id, int N)
{
_N = N;
if (N > 3)
maxcor = 510;
///cout << (ceil)(2.0) << endl;
cur.clear();
x = maxcor * 2;
long long lf = -maxcor * maxcor, rf = maxcor * maxcor;
intersection_points();
vector < long long > it1 = cur;
cur.clear();
x = maxcor * 2 + 1;
intersection_points();
vector < long long > it2 = cur;
sort(it1.begin(), it1.end());
sort(it2.begin(), it2.end());
vector < int > a, b;
for (int i = 0; i < it1.size(); i ++)
{
a.push_back((round)(it2[i] - it1[i]));
b.push_back((round)(it2[i] - x * (it2[i] - it1[i])));
}
the_lines_are(a, b);
}
Compilation message (stderr)
# | 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... |