제출 #1187201

#제출 시각아이디문제언어결과실행 시간메모리
1187201iarahaNile (IOI24_nile)C++20
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h>
// #pragma GCC optimize "Ofast"
using namespace std;
using ld = long double;
#define ll long long
#define pf push_front
#define pof pop_front
#define pb push_back
#define pob pop_back
#define fi first
#define se second
////////////////// fresh air //////////////////
vector<ll> calculate_costs(vector<int> w, vector<int> costa, vector<int> costb, deque<int> q) {
    int n = w.size();
    vector<ll> otv;
    while (!q.empty()) {
        int d = q.front(), ans = 0;
        q.pof();
        vector<pair<int, int>> a;
        bool is[n] = {};
        for (int i = 0; i < n; i++) {
            a.pb({w[i], i});
        }
        sort(a.begin(), a.end());
        for (int i = 0; i < n - 1; i++) {
            if (a[i + 1].fi - a[i].fi <= d) {
                is[i] = is[i + 1] = 1;
            }
        }
        int l = -1, mn = 1e9;
        for (int i = 0; i < n; i++) {
            int pos = a[i].se;
            if (is[i]) {
                if (l == -1) l = i;
                if (costa[pos] - costb[pos] < mn) {
                    mn = costa[pos] - costb[pos];
                }
                ans += costb[pos];
            }
            else {
                ans += costa[pos];
                ans += (l != -1 && (i - l) % 2) * mn;
                l = -1;
                mn = 1e9;
            }
            // cout << a[i].fi << ' ' << a[i].se << ' ' << is[i] << ' ' << pos << ' ' << ans << "\n";
        }
        ans += (l != -1 && (n - l) % 2) * mn;
        otv.pb(ans);
        // cout << otv.back() << "\n";
    }
    return (otv);
}
// signed main() {
//     ios_base::sync_with_stdio(0);яяяя
//     cin.tie(NULL); cout.tie(NULL);
//     int T = 1;
//     //cin >> T;
//     //cout << setprecision(8) << fixed;
//     while (T--) {
//         // calculate_costs({15, 12, 2, 10, 21}, {5, 4, 5, 6, 3}, {1, 2, 2, 3, 2}, {5, 9, 1});
//     }
// }

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

/usr/bin/ld: /tmp/cctbRluc.o: in function `main':
grader.cpp:(.text.startup+0x30e): 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