# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
743130 | salmon | Nicelines (RMI20_nicelines) | C++14 | 12 ms | 208 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 <bits/stdc++.h>
using namespace std;
#include "nice_lines.h"
void solve(int subtask_id, int N) {
if(subtask_id != 1){
the_lines_are({1}, {0});
return;
}
long double topgrad = (query(0,100000000000 + 0.000001) - query(0,100000000000))/0.000001;
long double s = -1000000000000;
long double e = 1000000000000;
for(int i = 0; i < 200; i++){
long double m1 = (s + e)/2;
long double m2 = (s + e)/2 + 0.000001;
if((query(0,m1) - query(0,m2))/(m2 - m1) == topgrad){
s = m1;
}
else{
e = m2;
}
}
long double xone = 0;
long double yone = s;
s = -1000000000000;
e = 1000000000000;
for(int i = 0; i < 200; i++){
long double m1 = (s + e)/2;
long double m2 = (s + e)/2 + 0.000001;
if((query(0,m1) - query(0,m2))/(m2 - m1) == topgrad){
s = m1;
}
else{
e = m2;
}
}
int a = (int) round(s - yone);
int b = (int) round(yone);
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... |