#include "nice_lines.h"
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define mp make_pair
#define pb emplace_back
#define ALL(x) x.begin(),x.end()
#define SZ(x) (int)x.size()
typedef long long ll;
typedef pair<int,int> ii;
typedef pair<ii,ii> i4;
typedef vector<int> vi;
const int MOD=1000000007;
const int INF=1012345678;
const ll LLINF=1012345678012345678LL;
const double PI=3.1415926536;
const double EPS=1e-14;
void solve(int subtask_id, int N) {
if(N==1){
long double s=query(0,0);
long double t=query(0,1);
long double k=abs(s-t);
long double b=s/k;
if(abs(query(0,b))<EPS){
if(query(1,0)-s>-EPS){
// a>=0 => k>0
long double a1=-k*k + sqrt(2*k*k-1) / (k*k-1);
long double a2=-k*k - sqrt(2*k*k-1) / (k*k-1);
if(query(1,a1+b)<EPS)the_lines_are({(int)round(a1)},{(int)round(b)});
else the_lines_are({(int)round(a2)},{(int)round(b)});
}else{
// a<0 => k<0
k=-k;
long double a1=-k*k + sqrt(2*k*k-1) / (k*k-1);
long double a2=-k*k - sqrt(2*k*k-1) / (k*k-1);
if(query(1,a1+b)<EPS)the_lines_are({(int)round(a1)},{(int)round(b)});
else the_lines_are({(int)round(a2)},{(int)round(b)});
}
}else{
b=-b;
if(s-query(1,0)>-EPS){
// a>=0 => k>0
long double a1=-k*k + sqrt(2*k*k-1) / (k*k-1);
long double a2=-k*k - sqrt(2*k*k-1) / (k*k-1);
if(query(1,a1+b)<EPS)the_lines_are({(int)round(a1)},{(int)round(b)});
else the_lines_are({(int)round(a2)},{(int)round(b)});
}else{
// a<0 => k<0
k=-k;
long double a1=-k*k + sqrt(2*k*k-1) / (k*k-1);
long double a2=-k*k - sqrt(2*k*k-1) / (k*k-1);
if(query(1,a1+b)<EPS)the_lines_are({(int)round(a1)},{(int)round(b)});
else the_lines_are({(int)round(a2)},{(int)round(b)});
}
}
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
308 KB |
Wrong query |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 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 |
1 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 |
- |