Submission #727088

#TimeUsernameProblemLanguageResultExecution timeMemory
727088iskhakkutbilimRoad Closures (APIO21_roads)C++14
Compilation error
0 ms0 KiB
#include "roads.h" #include <bits/stdc++.h> using namespace std; #define ff first #define ss second vector<long long> minimum_closure_costs(int N, vector<int> U, vector<int> V, vector<int> W) { vector<long long> ans; int sub1 = 1, sub2 = 1; for(int i = 0;i < N-1; i++){ if(U[i] != 0) sub1 = 0; if(U[i] != i or V[i] != i+1) sub2 = 0; } int sum = 0; for(int i = 0;i < N-1; i++) sum+= W[i]; ans.push_back(sum); if(sub1){ sort(all(W[i])); sum = 0; for(int i = 0;i < N-1; i++){ sum+= W[i]; } for(int i = N-2; i >= 0; i--){ sum-= W[i]; ans.push_back(sum); } }else if(sub2){ }else{ } return ans; }

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:18:14: error: 'i' was not declared in this scope
   18 |   sort(all(W[i]));
      |              ^
roads.cpp:18:8: error: 'all' was not declared in this scope
   18 |   sort(all(W[i]));
      |        ^~~