Submission #1236256

#TimeUsernameProblemLanguageResultExecution timeMemory
1236256mathias_abadieNile (IOI24_nile)C++20
Compilation error
0 ms0 KiB
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;

vector<long long> calculate_costs(
    vector<int> W, vector<int> A, vector<int> B, vector<int> E
) {
    int N = W.size();
    int Q = E.size();
    vector<long long> R;

    for (int d : E) {
        vector<int> indices(N);
        for (int i = 0; i < N; ++i) indices[i] = i;

        sort(indices.begin(), indices.end(), [&](int i, int j) {
            return W[i] < W[j];
        });

        vector<bool> used(N, false);
        long long total_cost = 0;

        for (int i = 0; i < N; ++i) {
            if (used[indices[i]]) continue;

            if (i + 1 < N && !used[indices[i + 1]]) {
                int art1 = indices[i];
                int art2 = indices[i + 1];
                if (abs(W[art] - W[art2]) <= d) {
                    long long pair_cost = B[art1] + B[art2];
                }
            }

            total_cost += A[indices[i]];
            used[indices[i]] = true;
        }

        R.push_back(total_cost);
    }

    return R;
}

Compilation message (stderr)

nile.cpp: In function 'std::vector<long long int> calculate_costs(std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>)':
nile.cpp:30:27: error: 'art' was not declared in this scope; did you mean 'art2'?
   30 |                 if (abs(W[art] - W[art2]) <= d) {
      |                           ^~~
      |                           art2