제출 #1353428

#제출 시각아이디문제언어결과실행 시간메모리
1353428SulALottery (JOI25_lottery)C++20
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define popcount __builtin_popcount
#define all(a) (a).begin(), (a).end()
using namespace std;
using namespace chrono;
using namespace __gnu_pbds;
template<typename T> using ordered_set = tree<T,null_type,less_equal<>,rb_tree_tag,tree_order_statistics_node_update>;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int n, q; cin >> n >> q;
    int X[n], Y[n];
    for (int i = 0; i < n; cin >> X[i++]);
    for (int i = 0; i < n; cin >> Y[i++]);

    auto check = [&](int l, int r, int k) {
        long long mn = 0, mx = 0;
        for (int i = l; i < r; i++) {
            if (X[i] + Y[i] < k) return false;
            mn += max(0, k - Y[i]);
            mx += min(X[i], k);
        }
        long long half = (r-l)/2 * k;
//        cout<<l<<' '<<r<<' '<<k<<": "<<mn<<' '<<half<<' '<<mx<<'\n';
        return mn <= half && half <= mx;
    };

    while (q--) {
        int l,r; cin >> l >> r; r++;
        long long lo = 0, hi = 2e9+1;
        while (lo+1 < hi) {
            auto mid = (lo + hi)/2;
            (check(l, r, mid) ? lo : hi) = mid;
        }
        cout << lo << "\n";
    }
}

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

/usr/bin/ld: /tmp/cc9gyJ24.o: in function `main':
stub.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccOqgyER.o:lottery.cpp:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/cc9gyJ24.o: in function `main':
stub.cpp:(.text.startup+0x1b3): undefined reference to `init(int, int, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >)'
/usr/bin/ld: stub.cpp:(.text.startup+0x25d): undefined reference to `max_prize(int, int)'
collect2: error: ld returned 1 exit status