답안 #645166

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
645166 2022-09-26T11:36:05 Z TimDee Nicelines (RMI20_nicelines) C++17
컴파일 오류
0 ms 0 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 (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;
    }
    for (int i=1; i<=10; ++i) {
        if(query(i,a*i+b)!=0) cerr<<a<<' '<<b<<' '<<i<<' '<<query(i,a*i+b)<<'\n';
    }
    the_lines_are({a},{b});
}

Compilation message

/usr/bin/ld: /tmp/ccjwXyRd.o: in function `main':
grader.cpp:(.text.startup+0x68): undefined reference to `solve(int, int)'
collect2: error: ld returned 1 exit status