답안 #1014727

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1014727 2024-07-05T10:57:51 Z idioti11 도서관 (JOI18_library) C++17
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;

int query(int a, int b) {
    cout << "? " << a << " " << b << endl;
    int result;
    cin >> result;
    return result;
}

int main() {
    int n;
    cin >> n;

    vector<int> sizes(n + 1, 0);
    int l = 1, r = n;
    
    while (l < r) {
        int mid = (l + r) / 2;
        int max1 = query(l, mid);
        int max2 = query(mid + 1, r);
        
        if (max1 < max2) {
            l = mid + 1;
        } else {
            r = mid;
        }
    }
    
    cout << "! " << l << endl;
    return 0;
}

Compilation message

/usr/bin/ld: /tmp/ccJduhhe.o: in function `main':
library.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccBumrfg.o:grader.cpp:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/ccBumrfg.o: in function `main':
grader.cpp:(.text.startup+0x25): undefined reference to `Solve(int)'
collect2: error: ld returned 1 exit status