Submission #1056186

#TimeUsernameProblemLanguageResultExecution timeMemory
1056186GangstaRoad Closures (APIO21_roads)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #define ll long long int #define pb push_back using namespace std; vector<ll> minimum_closure_costs(int n, vector<int> u, vector<int> v, vector<int> w){ vector <ll> s, ans; bool tr = 0; ll sum = 0, san = 0, sm = 0, sm1 = 0; for(int i = 0; i < n-1; i++){ if(w[i]) tr = 1; if(i % 2) sm += w[i]; else sm1 += w[i]; s.pb(w[i]); sum += w[i]; } if(tr){ for(int i = 0; i < n; i++){ if(i == 0) ans.pb(sum); else if(i == 1) ans.pb(min(sm,sm1)); else ans.pb(0); } } else{ sort(s.rbegin(), s.rend()); ans.pb(sum); for(auto i: s){ san += i; ans.pb(sum-san); } } return ans; } int main(){ int n; cin >> n; vector <int> u, v, w; for(int i = 0; i < n-1; i++){ int x, y, z; cin >> x >> y >> z; u.pb(x); v.pb(y); w.pb(z); } for(auto i: minimum_closure_costs(n, u, v, w)) cout << i << ' '; }

Compilation message (stderr)

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