Submission #848195

#TimeUsernameProblemLanguageResultExecution timeMemory
848195mohammedMonemOvertaking (IOI23_overtaking)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include "overtaking.h" #define ll long long using namespace std; ll roadLength; vector<ll> sortingStationsPositions; class bus { public: ll departingTime; ll speed; bus(ll departingTimeP, int speedP) { departingTime = departingTimeP; speed = speedP; } }; vector<bus> buses; void init(int L, int N, vector<ll> T, vector<int> W, int X, __attribute__((unused)) int M, vector<int> S) { roadLength = L, sortingStationsPositions = std::move(S); for (int i = 0; i < N; ++i) { buses.emplace_back(T[i], W[i]); } buses.emplace_back(0, X); } long long arrival_time(long long Y) { return Y + roadLength * buses.back().speed; }

Compilation message (stderr)

overtaking.cpp: In function 'void init(int, int, std::vector<long long int>, std::vector<int>, int, int, std::vector<int>)':
overtaking.cpp:25:59: error: no match for 'operator=' (operand types are 'std::vector<long long int>' and 'std::remove_reference<std::vector<int>&>::type' {aka 'std::vector<int>'})
   25 |     roadLength = L, sortingStationsPositions = std::move(S);
      |                                                           ^
In file included from /usr/include/c++/10/vector:72,
                 from /usr/include/c++/10/functional:62,
                 from /usr/include/c++/10/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/10/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from overtaking.cpp:1:
/usr/include/c++/10/bits/vector.tcc:198:5: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(const std::vector<_Tp, _Alloc>&) [with _Tp = long long int; _Alloc = std::allocator<long long int>]'
  198 |     vector<_Tp, _Alloc>::
      |     ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/10/bits/vector.tcc:199:42: note:   no known conversion for argument 1 from 'std::remove_reference<std::vector<int>&>::type' {aka 'std::vector<int>'} to 'const std::vector<long long int>&'
  199 |     operator=(const vector<_Tp, _Alloc>& __x)
      |               ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
In file included from /usr/include/c++/10/vector:67,
                 from /usr/include/c++/10/functional:62,
                 from /usr/include/c++/10/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/10/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from overtaking.cpp:1:
/usr/include/c++/10/bits/stl_vector.h:709:7: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::vector<_Tp, _Alloc>&&) [with _Tp = long long int; _Alloc = std::allocator<long long int>]'
  709 |       operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move())
      |       ^~~~~~~~
/usr/include/c++/10/bits/stl_vector.h:709:26: note:   no known conversion for argument 1 from 'std::remove_reference<std::vector<int>&>::type' {aka 'std::vector<int>'} to 'std::vector<long long int>&&'
  709 |       operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move())
      |                 ~~~~~~~~~^~~
/usr/include/c++/10/bits/stl_vector.h:730:7: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::initializer_list<_Tp>) [with _Tp = long long int; _Alloc = std::allocator<long long int>]'
  730 |       operator=(initializer_list<value_type> __l)
      |       ^~~~~~~~
/usr/include/c++/10/bits/stl_vector.h:730:46: note:   no known conversion for argument 1 from 'std::remove_reference<std::vector<int>&>::type' {aka 'std::vector<int>'} to 'std::initializer_list<long long int>'
  730 |       operator=(initializer_list<value_type> __l)
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~