Submission #569471

#TimeUsernameProblemLanguageResultExecution timeMemory
569471TurkhuuRoad Closures (APIO21_roads)C++17
Compilation error
0 ms0 KiB
#include "roads.h" #include <bits/stdc++.h> std::vector<long long> minimum_closure_costs(int n, std::vector<int> u, std::vector<int> v, std::vector<int> w){ sort(w.begin(), w.end()); vector<long long> ans(n); for(int i = 0; i < n - 1; i++){ ans[n - i - 2] = ans[n - i - 1] + w[i]; } 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:5:3: error: 'vector' was not declared in this scope
    5 |   vector<long long> ans(n);
      |   ^~~~~~
roads.cpp:5:3: note: suggested alternatives:
In file included from /usr/include/c++/10/vector:67,
                 from roads.h:1,
                 from roads.cpp:1:
/usr/include/c++/10/bits/stl_vector.h:389:11: note:   'std::vector'
  389 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
In file included from roads.h:1,
                 from roads.cpp:1:
/usr/include/c++/10/vector:86:13: note:   'std::pmr::vector'
   86 |       using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
      |             ^~~~~~
roads.cpp:5:10: error: expected primary-expression before 'long'
    5 |   vector<long long> ans(n);
      |          ^~~~
roads.cpp:7:5: error: 'ans' was not declared in this scope; did you mean 'abs'?
    7 |     ans[n - i - 2] = ans[n - i - 1] + w[i];
      |     ^~~
      |     abs
roads.cpp:9:10: error: 'ans' was not declared in this scope; did you mean 'abs'?
    9 |   return ans;
      |          ^~~
      |          abs