Submission #737297

#TimeUsernameProblemLanguageResultExecution timeMemory
737297keisuke6Road Closures (APIO21_roads)C++14
Compilation error
0 ms0 KiB
#include "roads.h" #include <vector> #include <algorithm> using namespace std; #define int long long std::vector<int> minimum_closure_costs(int N, std::vector<int> U, std::vector<int> V, std::vector<int> W) { sort(W.begin(),W.end()); vector<int> A = {0}; int now = 0; for(int i=0;i<W;i++){ now += W[i]; A.push_back(now); } reverse(A.begin(),A.end()); return A; }

Compilation message (stderr)

roads.cpp: In function 'std::vector<long long int> minimum_closure_costs(long long int, std::vector<long long int>, std::vector<long long int>, std::vector<long long int>)':
roads.cpp:11:16: error: no match for 'operator<' (operand types are 'long long int' and 'std::vector<long long int>')
   11 |   for(int i=0;i<W;i++){
      |               ~^~
      |               | |
      |               | std::vector<long long int>
      |               long long int
In file included from /usr/include/c++/10/bits/stl_algobase.h:64,
                 from /usr/include/c++/10/vector:60,
                 from roads.h:1,
                 from roads.cpp:1:
/usr/include/c++/10/bits/stl_pair.h:489:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator<(const std::pair<_T1, _T2>&, const std::pair<_T1, _T2>&)'
  489 |     operator<(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
      |     ^~~~~~~~
/usr/include/c++/10/bits/stl_pair.h:489:5: note:   template argument deduction/substitution failed:
roads.cpp:11:17: note:   mismatched types 'const std::pair<_T1, _T2>' and 'long long int'
   11 |   for(int i=0;i<W;i++){
      |                 ^
In file included from /usr/include/c++/10/bits/stl_algobase.h:67,
                 from /usr/include/c++/10/vector:60,
                 from roads.h:1,
                 from roads.cpp:1:
/usr/include/c++/10/bits/stl_iterator.h:366:5: note: candidate: 'template<class _Iterator> bool std::operator<(const std::reverse_iterator<_Iterator>&, const std::reverse_iterator<_Iterator>&)'
  366 |     operator<(const reverse_iterator<_Iterator>& __x,
      |     ^~~~~~~~
/usr/include/c++/10/bits/stl_iterator.h:366:5: note:   template argument deduction/substitution failed:
roads.cpp:11:17: note:   mismatched types 'const std::reverse_iterator<_Iterator>' and 'long long int'
   11 |   for(int i=0;i<W;i++){
      |                 ^
In file included from /usr/include/c++/10/bits/stl_algobase.h:67,
                 from /usr/include/c++/10/vector:60,
                 from roads.h:1,
                 from roads.cpp:1:
/usr/include/c++/10/bits/stl_iterator.h:404:5: note: candidate: 'template<class _IteratorL, class _IteratorR> bool std::operator<(const std::reverse_iterator<_Iterator>&, const std::reverse_iterator<_IteratorR>&)'
  404 |     operator<(const reverse_iterator<_IteratorL>& __x,
      |     ^~~~~~~~
/usr/include/c++/10/bits/stl_iterator.h:404:5: note:   template argument deduction/substitution failed:
roads.cpp:11:17: note:   mismatched types 'const std::reverse_iterator<_Iterator>' and 'long long int'
   11 |   for(int i=0;i<W;i++){
      |                 ^
In file included from /usr/include/c++/10/bits/stl_algobase.h:67,
                 from /usr/include/c++/10/vector:60,
                 from roads.h:1,
                 from roads.cpp:1:
/usr/include/c++/10/bits/stl_iterator.h:1451:5: note: candidate: 'template<class _IteratorL, class _IteratorR> bool std::operator<(const std::move_iterator<_IteratorL>&, const std::move_iterator<_IteratorR>&)'
 1451 |     operator<(const move_iterator<_IteratorL>& __x,
      |     ^~~~~~~~
/usr/include/c++/10/bits/stl_iterator.h:1451:5: note:   template argument deduction/substitution failed:
roads.cpp:11:17: note:   mismatched types 'const std::move_iterator<_IteratorL>' and 'long long int'
   11 |   for(int i=0;i<W;i++){
      |                 ^
In file included from /usr/include/c++/10/bits/stl_algobase.h:67,
                 from /usr/include/c++/10/vector:60,
                 from roads.h:1,
                 from roads.cpp:1:
/usr/include/c++/10/bits/stl_iterator.h:1507:5: note: candidate: 'template<class _Iterator> bool std::operator<(const std::move_iterator<_IteratorL>&, const std::move_iterator<_IteratorL>&)'
 1507 |     operator<(const move_iterator<_Iterator>& __x,
      |     ^~~~~~~~
/usr/include/c++/10/bits/stl_iterator.h:1507:5: note:   template argument deduction/substitution failed:
roads.cpp:11:17: note:   mismatched types 'const std::move_iterator<_IteratorL>' and 'long long int'
   11 |   for(int i=0;i<W;i++){
      |                 ^
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:1930:5: note: candidate: 'template<class _Tp, class _Alloc> bool std::operator<(const std::vector<_Tp, _Alloc>&, const std::vector<_Tp, _Alloc>&)'
 1930 |     operator<(const vector<_Tp, _Alloc>& __x, const vector<_Tp, _Alloc>& __y)
      |     ^~~~~~~~
/usr/include/c++/10/bits/stl_vector.h:1930:5: note:   template argument deduction/substitution failed:
roads.cpp:11:17: note:   mismatched types 'const std::vector<_Tp, _Alloc>' and 'long long int'
   11 |   for(int i=0;i<W;i++){
      |                 ^
In file included from /usr/include/c++/10/bits/stl_algobase.h:67,
                 from /usr/include/c++/10/vector:60,
                 from roads.h:1,
                 from roads.cpp:1:
/usr/include/c++/10/bits/stl_iterator.h:1096:5: note: candidate: 'template<class _IteratorL, class _IteratorR, class _Container> bool __gnu_cxx::operator<(const __gnu_cxx::__normal_iterator<_IteratorL, _Container>&, const __gnu_cxx::__normal_iterator<_IteratorR, _Container>&)'
 1096 |     operator<(const __normal_iterator<_IteratorL, _Container>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/10/bits/stl_iterator.h:1096:5: note:   template argument deduction/substitution failed:
roads.cpp:11:17: note:   mismatched types 'const __gnu_cxx::__normal_iterator<_IteratorL, _Container>' and 'long long int'
   11 |   for(int i=0;i<W;i++){
      |                 ^
In file included from /usr/include/c++/10/bits/stl_algobase.h:67,
                 from /usr/include/c++/10/vector:60,
                 from roads.h:1,
                 from roads.cpp:1:
/usr/include/c++/10/bits/stl_iterator.h:1104:5: note: candidate: 'template<class _Iterator, class _Container> bool __gnu_cxx::operator<(const __gnu_cxx::__normal_iterator<_Iterator, _Container>&, const __gnu_cxx::__normal_iterator<_Iterator, _Container>&)'
 1104 |     operator<(const __normal_iterator<_Iterator, _Container>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/10/bits/stl_iterator.h:1104:5: note:   template argument deduction/substitution failed:
roads.cpp:11:17: note:   mismatched types 'const __gnu_cxx::__normal_iterator<_Iterator, _Container>' and 'long long int'
   11 |   for(int i=0;i<W;i++){
      |                 ^