Submission #1067004

#TimeUsernameProblemLanguageResultExecution timeMemory
1067004ZanPOvertaking (IOI23_overtaking)C++17
Compilation error
0 ms0 KiB
#include "overtaking.h" #include <iostream> #include <vector> #include <algorithm> using namespace std; #define ll long long vector<vector<ll>> a; int n,m,x; vector<ll> s; void init(int L, int N, vector<ll> T, vector<int> W, int X, int M, vector<int> S) { n = N; m = M; x = X; s = S; a.resize(M); vector<pair<ll,ll>> b(n); for(int i = 0;i<n;i++){b[i].first = -W[i]; b[i].second = T[i]; } sort(b.begin(), b.end()); for(int i = 0;i<n;i++){ a[0].push_back(b[i].second); //cout << "{ " << b[i].second; for(int j = 1;j<m;j++){ ll n_t = a[j-1][i] + (s[j] - s[j-1])*(-b[i].first); for(int k = 0;k<i; k++){ if(a[j-1][k] < a[j-1][i] && a[j][k] > n_t){ n_t = a[j][k]; } } a[j].push_back(n_t); //cout << " - " << n_t; } //cout << "}\n"; } } ll arrival_time(ll y) { ll prev_t = y; //cout << "{ " << y; for(int j = 1;j<m;j++){ ll n_t = prev_t + (s[j] - s[j-1])*x; for(int k = 0;k<n; k++){ if(a[j-1][k] < prev_t && a[j][k] > n_t){ n_t = a[j][k]; } } prev_t = n_t; //cout << " - " << n_t; } //cout << "}\n"; return prev_t; } // int main(){ // init(6, 4, {20,10,40,0}, {5,20,20,30}, 10, 4, {0,1,3,6}); // int t; cin >> t; // while(t--){ // int h; cin >> h; // cout << arrival_time(h) << '\n'; // } // }

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:14:9: error: no match for 'operator=' (operand types are 'std::vector<long long int>' and 'std::vector<int>')
   14 |     s = 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)
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~