제출 #1368503

#제출 시각아이디문제언어결과실행 시간메모리
1368503kahoulA Difficult(y) Choice (BOI21_books)C++20
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h>

#include "books.h"
#define int long long

const int inf = 1e18 + 10;

using namespace std;
//
// --- Sample implementation for the task books ---
//
// To compile this program with the sample grader, place:
//     books.h books.cpp grader.cpp
// in a single folder and run:
//     g++ books.cpp grader.cpp
// in this folder.
//

void solve(signed n, signed k, long long A, int s) {
    vector<int> a(n); for (int i = 0; i < n; i++) a[i] = skim(i + 1);
    multiset<pair<int, int>> b;
    b.insert({inf, -1});

    for (int i = 0; i < n; i++) b.insert({a[i], i});

    for (int i = 0; i < n; i++) {
        b.erase({a[i], i});
        for (int j = i + 1; j < n; j++) {
            b.erase({a[j], j});
            int sum = a[j] + a[i];
            int exp = A - sum;
            auto [guy, idx] = *b.lower_bound({exp, 0});
            if (A <= sum + guy && sum + guy <= 2 * A) {
                vector<signed> ans;
                ans.push_back(i + 1);
                ans.push_back(j + 1);
                ans.push_back(idx + 1);
                answer(ans);
                return;
            }
            b.insert({a[j], j});
        }
        b.insert({a[i], i});
    }
    
    impossible();
}

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

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