Submission #1056201

#TimeUsernameProblemLanguageResultExecution timeMemory
1056201GangstaRoad Closures (APIO21_roads)C++14
0 / 100
18 ms3796 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> ans; ll san = 0, sm = 0, sm1 = 0; for(int i = 0; i < n-1; i++){ if(i % 2) sm += w[i]; else sm1 += w[i]; } for(int i = 0; i < n; i++){ if(i == 0) ans.pb(sm+sm1); else if(i == 1) ans.pb(min(sm,sm1)); else ans.pb(0); } 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)

roads.cpp: In function 'std::vector<long long int> minimum_closure_costs(int, std::vector<int>, std::vector<int>, std::vector<int>)':
roads.cpp:9:5: warning: unused variable 'san' [-Wunused-variable]
    9 |  ll san = 0, sm = 0, sm1 = 0;
      |     ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...