Submission #1172260

#TimeUsernameProblemLanguageResultExecution timeMemory
1172260_ncng.nyrNile (IOI24_nile)C++20
Compilation error
0 ms0 KiB
#include<bits/stdc++.h>

#define int long long

using namespace std;

const int N = 2e5 + 5,
          oo = 1e16;

int n, q;
int a[N], b[N], w[N];

vector<int> calculate_costs(
    vector<int> W, vector<int> A,
    vector<int> B, vector<int> E) {

    n = W.size();
    for(int i = 1; i <= n; ++i) w[i] = W[i - 1], a[i] = A[i - 1], b[i] = B[i - 1];
    vector<int> ans;

    for(auto D : E) {
      int res = 0;
      for(int i = 1; i <= n; ++i) res += b[i];

      if(n & 1) {
        int sub = oo;
        for(int i = 1; i <= n; ++i) sub = min(sub, a[i] - b[i]);
        res += sub;
      }

      ans.push_back(res);
    }

  return ans;
}

// #define ntc
#ifdef ntc
int32_t main() {
  cin.tie(0)->sync_with_stdio(0);

  if(fopen("task.inp", "r")) {
    freopen("task.inp", "r", stdin);
    freopen("task.out", "w", stdout);
  }

  if(fopen("NILE.inp", "r")) {
    freopen("NILE.inp", "r", stdin);
    freopen("NILE.out", "w", stdout);
  }

  vector<int> W, A, B, E;

  cin >> n;
  for(int i = 1; i <= n; ++i) {
    int w, a, b; cin >> w >> a >> b;
    W.push_back(w); A.push_back(a); B.push_back(b);
  }

  cin >> q;
  for(int i = 1; i <= q; ++i) {
    int D; cin >> D;
    E.push_back(D);
  }

  vector<int> ans = calculate_costs(W, A, B, E);
  for(auto x : ans) cout << x << '\n';
}
#endif

Compilation message (stderr)

/usr/bin/ld: /tmp/ccvOduYT.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