Submission #570121

#TimeUsernameProblemLanguageResultExecution timeMemory
570121Garguy22Road Closures (APIO21_roads)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include <vector> #include <algorithm> using namespace std; typedef long long ll; typedef vector<int> vi; typedef vector<ll> vl; #define pb push_back; vl minimum_closure_costs(int N, vi U, vi V, vi W){ ll temp = 0; vi ans; sort(W.begin(), W.end()); ans.pb(0); for(int i = 0; i < n; i++){ temp += w[i]; ans.pb(temp); } reverse(ans.begin(), ans.end()); return ans; }

Compilation message (stderr)

roads.cpp: In function 'vl minimum_closure_costs(int, vi, vi, vi)':
roads.cpp:9:12: error: statement cannot resolve address of overloaded function
    9 | #define pb push_back;
      |            ^
roads.cpp:15:6: note: in expansion of macro 'pb'
   15 |  ans.pb(0);
      |      ^~
roads.cpp:15:9: warning: statement has no effect [-Wunused-value]
   15 |  ans.pb(0);
      |        ~^~
roads.cpp:16:21: error: 'n' was not declared in this scope
   16 |  for(int i = 0; i < n; i++){
      |                     ^
roads.cpp:17:11: error: 'w' was not declared in this scope
   17 |   temp += w[i];
      |           ^
roads.cpp:9:12: error: statement cannot resolve address of overloaded function
    9 | #define pb push_back;
      |            ^
roads.cpp:18:7: note: in expansion of macro 'pb'
   18 |   ans.pb(temp);
      |       ^~
roads.cpp:18:10: warning: statement has no effect [-Wunused-value]
   18 |   ans.pb(temp);
      |         ~^~~~~
roads.cpp:21:9: error: could not convert 'ans' from 'vector<int>' to 'vector<long long int>'
   21 |  return ans;
      |         ^~~
      |         |
      |         vector<int>