제출 #1337725

#제출 시각아이디문제언어결과실행 시간메모리
1337725kawhietXylophone (JOI18_xylophone)C++20
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h>
using namespace std;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n;
    cin >> n;
    auto ask = [&](vector<int> k) {
        cout << k.size();
        for (auto i : k) {
            cout << ' ' << i + 1;
        }
        cout << endl;
        int ret;
        cin >> ret;
        return ret;
    };
    vector<int> ans(n, -1);
    ans[0] = 1;
    vector<int> pos = {0};
    for (int i = 1; i < n; i++) {
        pos.push_back(i);
        if (ask(pos) == pos.size()) {
            ans[i] = pos.size();
        } else {
            pos.pop_back();
            int l = -1, r = pos.size() - 1;
            while (l + 1 < r) {
                int m = (l + r) / 2;
                vector<int> s = {i};
                for (int i = 0; i <= m; i++) {
                    s.push_back(pos[i]);
                }
                if (ask(s) == s.size()) {
                    l = m;
                } else {
                    r = m;
                }
            }
            ans[i] = ans[pos[r]];
        }
    }
    cout << 0 << '\n';
    for (int i = 0; i < n; i++) {
        cout << ans[i] << ' ';
    }
    cout << '\n';
    return 0;
}

컴파일 시 표준 에러 (stderr) 메시지

/usr/bin/ld: /tmp/ccy3kfRF.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/cc0QNcqa.o:xylophone.cpp:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/ccy3kfRF.o: in function `main':
grader.cpp:(.text.startup+0x30): undefined reference to `solve(int)'
collect2: error: ld returned 1 exit status