제출 #1016728

#제출 시각아이디문제언어결과실행 시간메모리
1016728tmarcinkevicius추월 (IOI23_overtaking)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #include "overtaking.h" using namespace std; //void init(int32_t _L, int32_t _N, vector<int64_t> _T, vector<int32_t> _W, int32_t _X, int32_t _M, vector<int32_t> _S); //long long arrival_time(long long Y); vector<vector<int64_t>> Expected, Real; int32_t _L; int32_t _N; vector<int64_t> _T; vector<int32_t> _W; int32_t _X; int32_t _M; vector<int32_t> _S; void init(int L, int N, std::vector<long long> T, std::vector<int> W, int X, int M, std::vector<int> S) { W.push_back(X); _L = L; _N = N; _T = T; _W = W; _X = X; _M = M; _S = S; return; } long long arrival_time(long long Y) { Expected = vector<vector<int64_t>>(_N + 1); Real = vector<vector<int64_t>>(_N + 1); _T.push_back(Y); for (int i = 0; i <= _N; i++) { Expected[i] = vector<int64_t>(_M); Real[i] = vector<int64_t>(_M); Expected[i][0] = _T[i]; Real[i][0] = _T[i]; } for (int i = 1; i < _M; i++) { int dis = _S[i] - _S[i - 1]; for (int j = 0; j <= _N; j++) { Expected[j][i] = Real[j][i - 1] + dis * _W[j]; } for (int j = 0; j <= _N; j++) { Real[j][i] = Expected[j][i]; for (int z = 0; z <= _N; z++) { if (z == j) continue; if (Real[z][i - 1] < Real[j][i - 1]) { Real[j][i] = max(Real[j][i], Expected[z][i]); } } } } /*for (int i = 0; i <= N; i++) { cout << "i = " << i << " "; for (int j = 0; j < M; j++) { cout << "|e: " << setw(4) << Expected[i][j] << ", r: " << setw(4) << Real[i][j] << "| "; } cout << '\n'; }*/ _T.pop_back(); return Real[_N][_M - 1]; } /*int32_t main() { int L, N, X, M, Q; cin >> L >> N >> X >> M >> Q; vector<int64_t> T(N); for (int i = 0; i < N; i++) cin >> T[i]; vector<int32_t> W(N); for (int i = 0; i < N; i++) cin >> W[i]; vector<int32_t> S(M); for (int i = 0; i < M; i++) cin >> S[i]; vector<int> Y(Q); for (int i = 0; i < Q; i++) cin >> Y[i]; init(L, N, T, W, X, M, S); vector<int> res(Q); for (int i = 0; i < Q; i++) res[i] = arrival_time(Y[i]); for (int i = 0; i < Q; i++) cout << res[i] << '\n'; }*/

컴파일 시 표준 에러 (stderr) 메시지

overtaking.cpp: In function 'void init(int, int, std::vector<long long int>, std::vector<int>, int, int, std::vector<int>)':
overtaking.cpp:22:10: error: no match for 'operator=' (operand types are 'std::vector<long int>' and 'std::vector<long long int>')
   22 |     _T = T;
      |          ^
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 int; _Alloc = std::allocator<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<long long int>' to 'const std::vector<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 int; _Alloc = std::allocator<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<long long int>' to 'std::vector<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 int; _Alloc = std::allocator<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<long long int>' to 'std::initializer_list<long int>'
  730 |       operator=(initializer_list<value_type> __l)
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~