Submission #570224

#TimeUsernameProblemLanguageResultExecution timeMemory
570224ChrisM2309Road Closures (APIO21_roads)C++14
Compilation error
0 ms0 KiB
#include "roads.h" #include <bits/stdc++.h> using namespace std; typedef pair<int,int> ii; typedef long long ll; typedef vector<int> vi; typedef vector<ll> vll; typedef vector<vi> vvi; typedef vector<ii> vii; typedef vector<vii> wgraf; typedef pair<int,ii> edge; #define UNVISITED 0 #define VISITED 1 #define INF 1000000000 #define pb push_back #define F first #define S second #define all(x) (x).begin(), (x).end() std::vector<long long> minimum_closure_costs(int N, std::vector<int> U, std::vector<int> V, std::vector<int> W) { vi ans(N); sort(all(W)); ll sum 0; for (auto i : W) sum += i; ans.pb(sum); for (int i = 1; i < W.size(); i++){ sum -= W[i]; ans.pb(sum); } 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:25:9: error: expected initializer before numeric constant
   25 |  ll sum 0;
      |         ^
roads.cpp:26:19: error: 'sum' was not declared in this scope
   26 |  for (auto i : W) sum += i;
      |                   ^~~
roads.cpp:27:9: error: 'sum' was not declared in this scope
   27 |  ans.pb(sum);
      |         ^~~
roads.cpp:28:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   28 |  for (int i = 1; i < W.size(); i++){
      |                  ~~^~~~~~~~~~
roads.cpp:32:10: error: could not convert 'ans' from 'vector<int>' to 'vector<long long int>'
   32 |   return ans;
      |          ^~~
      |          |
      |          vector<int>