#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});
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
208 KB |
Output is correct |
2 |
Correct |
3 ms |
208 KB |
Output is correct |
3 |
Correct |
3 ms |
208 KB |
Output is correct |
4 |
Correct |
3 ms |
208 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
208 KB |
Unexpected end of file - int32 expected |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
208 KB |
Unexpected end of file - int32 expected |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
208 KB |
Unexpected end of file - int32 expected |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
208 KB |
Unexpected end of file - int32 expected |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
208 KB |
Unexpected end of file - int32 expected |
2 |
Halted |
0 ms |
0 KB |
- |