Submission #1208821

#TimeUsernameProblemLanguageResultExecution timeMemory
1208821sula2Nile (IOI24_nile)C++20
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #define all(a) a.begin(), a.end() #define popcount(x) __builtin_popcountll(x) using namespace std; using namespace chrono; long long solve(vector<int> W, vector<int> A, vector<int> B, int D) { int n = W.size(); vector<int> ind(n); iota(all(ind), 0); sort(all(ind), [&](int i, int j) { return W[i] < W[j]; }); vector<long long> dp(n); dp[0] = A[ind[0]]; for (int i = 1; i < n; i++) { dp[i] = dp[i-1] + A[ind[i]]; long long sum = 0; for (int j = i-1; j >= 0 && W[ind[i]] - W[ind[j]] <= D; j--) { dp[i] = min(dp[i], (j == 0 ? 0 : dp[j-1]) + B[ind[j]] + B[ind[i]] + sum); sum += A[ind[j]]; } } return dp[n-1]; } vector<long long> calculate_costs( vector<int> W, vector<int> A, vector<int> B, vector<int> E ) { int n = W.size(), q = E.size(); vector<long long> res(q); for (int i = 0; i < q; i++) { res[i] = solve(W, A, B, E[i]); } return res; } int main() { ios::sync_with_stdio(false); cin.tie(nullptr); for (auto x : calculate_costs({15, 12, 2, 10, 21}, {5, 4, 5, 6, 3}, {1, 2, 2, 3, 2}, {5, 1, 9})) cout << x << "\n"; }

Compilation message (stderr)

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