Submission #1105661

#TimeUsernameProblemLanguageResultExecution timeMemory
1105661KDM_DvaliNile (IOI24_nile)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; vector<ll> calculate_costs(vector<int> W, vector<int> A, vector<int> B, vector<int> E) { int n = W.size(); int q = E.size(); vector<ll> R(q, 0); ll sb = 0; for (int i = 0; i < n; i++) { sb += B[i]; } for (int i = 0; i < q; i++) { ll d = E[i]; long long pmin = LLONG_MAX; if (n % 2 == 0) { R[i] = sb; continue; } else { for (int j = 0; j < n; j++) { if (j % 2 == 0) { pmin = min(pmin, (long long)A[j] - B[j]); } if (j > 0 && j < n - 1) { if (W[j + 1] - W[j - 1] <= d) { pmin = min(pmin, (long long)A[j] - B[j]); } } } } R[i] = pmin + sb; } return R; } int main() { int n, q; cin >> n >> q; vector<int> W(n), A(n), B(n), E(q); for (int i = 0; i < n; i++) { W[i] = i + 1; cin >> A[i] >> B[i]; } for (int i = 0; i < q; i++) { cin >> E[i]; } vector<ll> result = calculate_costs(W, A, B, E); for (size_t i = 0; i < result.size(); i++) { cout << result[i] << " "; } cout << endl; return 0; }

Compilation message (stderr)

/usr/bin/ld: /tmp/ccWH9xdu.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccLANtlw.o:nile.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status