Submission #955561

#TimeUsernameProblemLanguageResultExecution timeMemory
955561Prieved1Overtaking (IOI23_overtaking)C++17
Compilation error
0 ms0 KiB
#include "overtaking.h" #include <bits/stdc++.h> using namespace std; long long speed; vector<vector<long long>> ta; vector<long long> ss; void init(int L, int N, std::vector<long long> T, std::vector<int> W, int X, int M, std::vector<int> S) { speed=X; ta=vector<vector<long long>> (M, vector<long long> (N)); ss=S; for(int i = 0;i<M;i++) { for(int j = 0;j<N;j++) { if(i==0)ta[i][j]=T[j]; else ta[i][j]=ta[i-1][j]+(long long)(S[i]-S[i-1])*W[j]; } if(i){ for(int j = 0;j<N;j++){ for(int k = 0;k<N;k++) { if(ta[i-1][j]>ta[i-1][k])ta[i][j]=max(ta[i][j], ta[i][k]); } } } } } long long arrival_time(long long Y) { long long pr=Y; long long cur=pr; for(int i = 1;i<ta.size();i++) { cur+=(ss[i]-ss[i-1])*speed; for(int j = 0;j<ta[i].size();j++) { if(ta[i-1][j]<pr)cur=max(cur, ta[i][j]); } pr=cur; } return cur; }

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:10:6: error: no match for 'operator=' (operand types are 'std::vector<long long int>' and 'std::vector<int>')
   10 |   ss=S;
      |      ^
In file included from /usr/include/c++/10/vector:72,
                 from overtaking.h:1,
                 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::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 overtaking.h:1,
                 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::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::vector<int>' to 'std::initializer_list<long long int>'
  730 |       operator=(initializer_list<value_type> __l)
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
overtaking.cpp: In function 'long long int arrival_time(long long int)':
overtaking.cpp:30:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::vector<long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   30 |   for(int i = 1;i<ta.size();i++) {
      |                 ~^~~~~~~~~~
overtaking.cpp:32:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   32 |     for(int j = 0;j<ta[i].size();j++) {
      |                   ~^~~~~~~~~~~~~