Submission #645163

# Submission time Handle Problem Language Result Execution time Memory
645163 2022-09-26T11:30:00 Z TimDee Nicelines (RMI20_nicelines) C++17
0 / 100
2 ms 292 KB
#include "nice_lines.h"
#include <bits/stdc++.h>
using namespace std;
#define ld long double

int n;
long double fix(long double x) {
    if (fabs(x)>1e12) {
        if (x<0) return -1e12;
        else return 1e12;
    }
    return x;
}

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 (x>=y && y<=z) {
            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(mid-1,0);
        ld y=query(mid,0);
        ld z=query(mid+1,0);
        if (x>=y && y<=z) {
            r=mid; break;
        }
        if (x<=y && y<=z) r=mid-1;
        else l=mid;
    }
    int a;
    if (r) 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 p2() {

}

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

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

    if (n==2) {
        p2(); return;
    }

}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 292 KB Output is correct
2 Incorrect 2 ms 208 KB Incorrect
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 208 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 208 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 208 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 256 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 208 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -