# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
743111 | salmon | Nicelines (RMI20_nicelines) | C++14 | 0 ms | 0 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <stdio.h>
#include "nice_lines.h"
void solve(int subtask_id, int N) {
if(subtask_id != 1){
the_lines_are({1}, {0});
return;
}
long double s = -1000000000000;
long double e = 1000000000000;
for(int i = 0; i < 200; i++){
long double m1 = (s * 2 + e)/3;
long double m2 = (s + e * 2)/3;
if(query(0,m1) > query(0,m2)){
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 * 2 + e)/3;
long double m2 = (s + e * 2)/3;
if(query(1,m1) > query(1,m2)){
s = m1;
}
else{
e = m2;
}
}
int a = (int) round(s - yone);
int b = (int) round(yone);
the_lines_are({a}, {b});
}