답안 #645194

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
645194 2022-09-26T12:01:18 Z TimDee Nicelines (RMI20_nicelines) C++17
11 / 100
2 ms 208 KB
#include "nice_lines.h"
#include <bits/stdc++.h>
using namespace std;
#define ld long double

int n;

void p1() {
    int l=-1e4, r=1e4;
    while (l<r) {
        int mid=(l+r+1)>>1;
        ld x=query(0,mid-1);
        ld y=query(0,mid);
        ld z=query(0,mid+1);
        if (y==0) {
            r=mid; break;
        }
        if (x<=y && y<=z) r=mid-1;
        else l=mid;
    }
    int b=r;
    l=-1e4, r=1e4;
    while (l<r) {
        int mid=(l+r+1)>>1;
        ld x=query(1,mid-1);
        ld y=query(1,mid);
        ld z=query(1,mid+1);
        if (y==0) {
            r=mid; break;
        }
        if (x<=y && y<=z) r=mid-1;
        else l=mid;
    }
    ld x=query(0,b), y=query(1,b);
    assert(x==0);
    if (x==y) {
        the_lines_are({0},{b});
        return;
    }
    int a=r-b;
    /*if (r) {
        assert(b!=0);
        assert((b%r)==0);
        a=-b/r;
    }
    else {
        if (query(1,1)==0) a=1;
        else if (query(1,-1)==0) a=-1;
        else a=0;
    }*/
    the_lines_are({a},{b});
}

void solve(int id, int N) {
    n=N;

    if (n==1) {
        p1(); return;
    }
    exit(1);

}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 208 KB Output is correct
2 Correct 2 ms 208 KB Output is correct
3 Correct 1 ms 208 KB Output is correct
4 Correct 2 ms 208 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Runtime error 0 ms 208 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 0 ms 208 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 0 ms 208 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 208 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 0 ms 208 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -