제출 #1285888

#제출 시각아이디문제언어결과실행 시간메모리
1285888nigar선물 (IOI25_souvenirs)C++20
컴파일 에러
0 ms0 KiB
#include "souvenirs.h" #include <utility> #include <vector> using namespace std; void buy_souvenirs(int N, long long P0) { pair<vector<int>, long long> res; if (N == 2) { res = transaction P0 - 1; } return; }

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

souvenirs.cpp: In function 'void buy_souvenirs(int, long long int)':
souvenirs.cpp:10:15: error: no match for 'operator=' (operand types are 'std::pair<std::vector<int>, long long int>' and 'std::pair<std::vector<int>, long long int>(long long int)')
   10 |         res = transaction P0 - 1;
      |               ^~~~~~~~~~~
In file included from /usr/include/c++/13/utility:69,
                 from souvenirs.h:1,
                 from souvenirs.cpp:1:
/usr/include/c++/13/bits/stl_pair.h:439:9: note: candidate: 'template<class _U1, class _U2> constexpr std::pair<_T1, _T2>& std::pair<_T1, _T2>::operator=(const std::pair<_U1, _U2>&) requires  _S_assignable<const _U1&, const _U2&>() [with _U2 = _U1; _T1 = std::vector<int>; _T2 = long long int]'
  439 |         operator=(const pair<_U1, _U2>& __p)
      |         ^~~~~~~~
/usr/include/c++/13/bits/stl_pair.h:439:9: note:   template argument deduction/substitution failed:
souvenirs.cpp:10:15: note:   mismatched types 'const std::pair<_T1, _T2>' and 'std::pair<std::vector<int>, long long int>(long long int)'
   10 |         res = transaction P0 - 1;
      |               ^~~~~~~~~~~
/usr/include/c++/13/bits/stl_pair.h:451:9: note: candidate: 'template<class _U1, class _U2> constexpr std::pair<_T1, _T2>& std::pair<_T1, _T2>::operator=(std::pair<_U1, _U2>&&) requires  _S_assignable<_U1, _U2>() [with _U2 = _U1; _T1 = std::vector<int>; _T2 = long long int]'
  451 |         operator=(pair<_U1, _U2>&& __p)
      |         ^~~~~~~~
/usr/include/c++/13/bits/stl_pair.h:451:9: note:   template argument deduction/substitution failed:
souvenirs.cpp:10:15: note:   mismatched types 'std::pair<_T1, _T2>' and 'std::pair<std::vector<int>, long long int>(long long int)'
   10 |         res = transaction P0 - 1;
      |               ^~~~~~~~~~~
/usr/include/c++/13/bits/stl_pair.h:416:7: note: candidate: 'constexpr std::pair<_T1, _T2>& std::pair<_T1, _T2>::operator=(const std::pair<_T1, _T2>&) requires  _S_assignable<const _T1&, const _T2&>() [with _T1 = std::vector<int>; _T2 = long long int]'
  416 |       operator=(const pair& __p)
      |       ^~~~~~~~
/usr/include/c++/13/bits/stl_pair.h:416:29: note:   no known conversion for argument 1 from 'std::pair<std::vector<int>, long long int>(long long int)' to 'const std::pair<std::vector<int>, long long int>&'
  416 |       operator=(const pair& __p)
      |                 ~~~~~~~~~~~~^~~
/usr/include/c++/13/bits/stl_pair.h:427:7: note: candidate: 'constexpr std::pair<_T1, _T2>& std::pair<_T1, _T2>::operator=(std::pair<_T1, _T2>&&) requires  _S_assignable<_T1, _T2>() [with _T1 = std::vector<int>; _T2 = long long int]'
  427 |       operator=(pair&& __p)
      |       ^~~~~~~~
/usr/include/c++/13/bits/stl_pair.h:427:24: note:   no known conversion for argument 1 from 'std::pair<std::vector<int>, long long int>(long long int)' to 'std::pair<std::vector<int>, long long int>&&'
  427 |       operator=(pair&& __p)
      |                 ~~~~~~~^~~