Submission #1244432

#TimeUsernameProblemLanguageResultExecution timeMemory
1244432im2xtremeNile (IOI24_nile)C++20
Compilation error
0 ms0 KiB
#include "nile.h" #include <bits/stdc++.h> using namespace std; struct Artifact { int id; int weight; int A, B; int savings; }; 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<Artifact> artifacts(N); for (int i = 0; i < N; ++i) { artifacts[i] = {i, W[i], A[i], B[i], A[i] - B[i]}; } sort(artifacts.begin(), artifacts.end(), [](const Artifact &a, const Artifact &b) { return a.weight < b.weight; }); vector<long long> R(Q); for (int qi = 0; qi < Q; ++qi) { int D = E[qi]; vector<bool> used(N, false); long long total = 0; int l = 0, r = N - 1; while (l < r) { while (l < r && used[l]) l++; while (l < r && used[r]) r--; if (l >= r) break; if (abs(artifacts[l].weight - artifacts[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:40:55: error: no match for call to '(__gnu_cxx::__alloc_traits<std::allocator<Artifact>, Artifact>::value_type {aka Artifact}) ()'
   40 |             if (abs(artifacts[l].weight - artifacts[r]()
      |                                           ~~~~~~~~~~~~^~
nile.cpp:40:57: error: expected ')' at end of input
   40 |             if (abs(artifacts[l].weight - artifacts[r]()
      |                ~                                        ^
      |                                                         )
nile.cpp:40:57: error: expected statement at end of input
nile.cpp:40:57: error: expected '}' at end of input
nile.cpp:34:23: note: to match this '{'
   34 |         while (l < r) {
      |                       ^
nile.cpp:40:57: error: expected '}' at end of input
   40 |             if (abs(artifacts[l].weight - artifacts[r]()
      |                                                         ^
nile.cpp:27:36: note: to match this '{'
   27 |     for (int qi = 0; qi < Q; ++qi) {
      |                                    ^
nile.cpp:40:57: error: expected '}' at end of input
   40 |             if (abs(artifacts[l].weight - artifacts[r]()
      |                                                         ^
nile.cpp:12:95: note: to match this '{'
   12 | vector<long long> calculate_costs(vector<int> W, vector<int> A, vector<int> B, vector<int> E) {
      |                                                                                               ^
nile.cpp:40:57: warning: no return statement in function returning non-void [-Wreturn-type]
   40 |             if (abs(artifacts[l].weight - artifacts[r]()
      |                                                         ^