제출 #1278135

#제출 시각아이디문제언어결과실행 시간메모리
1278135GoBananas69나일강 (IOI24_nile)C++20
컴파일 에러
0 ms0 KiB
#include <algorithm>
#include <cmath>
#include <iostream>
#include <queue>
#include <set>
#include <vector>
typedef long long ll;
using namespace std;

// subtask 1
vector<ll> calculate_costs(vector<ll> w, vector<ll> a, vector<ll> b, vector<ll> e) {
    ll q = e.size();
    vector<ll> ans(q);
    for (ll _ = 0; _ < q; ++_) {
        ll n = w.size();
        // {a[i], b[i]}
        vector<pair<ll, ll>> v(n);
        for (ll i = 0; i < n; ++i) v[i] = {a[i], b[i]};
        sort(v.begin(), v.end());
        ll res = 0;
        for (ll i = 1; i < n; i += 2) res += (v[i].second + v[i + 1].second);
        if (n & 1) res += v[0].first;
        ans[_] = res;
    }
    return ans;
}

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

/usr/bin/ld: /tmp/ccSySd2b.o: in function `main':
grader.cpp:(.text.startup+0x2ff): undefined reference to `calculate_costs(std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >)'
collect2: error: ld returned 1 exit status