제출 #1256634

#제출 시각아이디문제언어결과실행 시간메모리
1256634medmdg선물 (IOI25_souvenirs)C++20
컴파일 에러
0 ms0 KiB
#include "souvenirs.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; void sub1(int N, long long P0) { pair<vector<int>, long long> res = transaction(P0-1); } void sub2(int N, ll P0){ for(int i=N-1;i>0;i--){ for(int j=N;j>i;j--){ transaction(i); } } } void sub3(int N,ll P0){ vector<ll> rem(N); for(int i=0;i<N;i++){ rem[i]=i; } ll cost=P0-1; for(int i=1;i<N;i++){ pair<vector<int>, long long> res =transaction(cost); for(auto x:res)rem[x]--; if(res.first.size()>1||res.second)cost--; while(rem[i]){ transaction(cost); } cost--; } } void sub4(int N, long long P0) { pair<vector<int>, long long> res = transaction(P0-1); ll cost=P0-1-res.second; //cout<<"#"<<cost<<endl; if(res.first.size()>1) transaction(cost/2); else{ transaction(cost-1); transaction(cost-1); } } void buy_souvenirs(int N, long long P0) { if(N==3)sub4(N,P0); else if(N==2) sub1(N,P0); else sub3(N,P0); return; }

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

souvenirs.cpp: In function 'void sub3(int, ll)':
souvenirs.cpp:25:16: error: no matching function for call to 'begin(std::pair<std::vector<int>, long long int>&)'
   25 |     for(auto x:res)rem[x]--;
      |                ^~~
In file included from /usr/include/c++/11/utility:76,
                 from souvenirs.h:1,
                 from souvenirs.cpp:1:
/usr/include/c++/11/initializer_list:90:5: note: candidate: 'template<class _Tp> constexpr const _Tp* std::begin(std::initializer_list<_Tp>)'
   90 |     begin(initializer_list<_Tp> __ils) noexcept
      |     ^~~~~
/usr/include/c++/11/initializer_list:90:5: note:   template argument deduction/substitution failed:
souvenirs.cpp:25:16: note:   'std::pair<std::vector<int>, long long int>' is not derived from 'std::initializer_list<_Tp>'
   25 |     for(auto x:res)rem[x]--;
      |                ^~~
In file included from /usr/include/c++/11/vector:69,
                 from souvenirs.h:2,
                 from souvenirs.cpp:1:
/usr/include/c++/11/bits/range_access.h:51:5: note: candidate: 'template<class _Container> constexpr decltype (__cont.begin()) std::begin(_Container&)'
   51 |     begin(_Container& __cont) -> decltype(__cont.begin())
      |     ^~~~~
/usr/include/c++/11/bits/range_access.h:51:5: note:   template argument deduction/substitution failed:
/usr/include/c++/11/bits/range_access.h: In substitution of 'template<class _Container> constexpr decltype (__cont.begin()) std::begin(_Container&) [with _Container = std::pair<std::vector<int>, long long int>]':
souvenirs.cpp:25:16:   required from here
/usr/include/c++/11/bits/range_access.h:51:50: error: 'struct std::pair<std::vector<int>, long long int>' has no member named 'begin'
   51 |     begin(_Container& __cont) -> decltype(__cont.begin())
      |                                           ~~~~~~~^~~~~
/usr/include/c++/11/bits/range_access.h:61:5: note: candidate: 'template<class _Container> constexpr decltype (__cont.begin()) std::begin(const _Container&)'
   61 |     begin(const _Container& __cont) -> decltype(__cont.begin())
      |     ^~~~~
/usr/include/c++/11/bits/range_access.h:61:5: note:   template argument deduction/substitution failed:
/usr/include/c++/11/bits/range_access.h: In substitution of 'template<class _Container> constexpr decltype (__cont.begin()) std::begin(const _Container&) [with _Container = std::pair<std::vector<int>, long long int>]':
souvenirs.cpp:25:16:   required from here
/usr/include/c++/11/bits/range_access.h:61:56: error: 'const struct std::pair<std::vector<int>, long long int>' has no member named 'begin'
   61 |     begin(const _Container& __cont) -> decltype(__cont.begin())
      |                                                 ~~~~~~~^~~~~
/usr/include/c++/11/bits/range_access.h:90:5: note: candidate: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::begin(_Tp (&)[_Nm])'
   90 |     begin(_Tp (&__arr)[_Nm]) noexcept
      |     ^~~~~
/usr/include/c++/11/bits/range_access.h:90:5: note:   template argument deduction/substitution failed:
souvenirs.cpp:25:16: note:   mismatched types '_Tp [_Nm]' and 'std::pair<std::vector<int>, long long int>'
   25 |     for(auto x:res)rem[x]--;
      |                ^~~
In file included from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:95,
                 from souvenirs.cpp:2:
/usr/include/c++/11/valarray:1217:5: note: candidate: 'template<class _Tp> _Tp* std::begin(std::valarray<_Tp>&)'
 1217 |     begin(valarray<_Tp>& __va) noexcept
      |     ^~~~~
/usr/include/c++/11/valarray:1217:5: note:   template argument deduction/substitution failed:
souvenirs.cpp:25:16: note:   'std::pair<std::vector<int>, long long int>' is not derived from 'std::valarray<_Tp>'
   25 |     for(auto x:res)rem[x]--;
      |                ^~~
In file included from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:95,
                 from souvenirs.cpp:2:
/usr/include/c++/11/valarray:1228:5: note: candidate: 'template<class _Tp> const _Tp* std::begin(const std::valarray<_Tp>&)'
 1228 |     begin(const valarray<_Tp>& __va) noexcept
      |     ^~~~~
/usr/include/c++/11/valarray:1228:5: note:   template argument deduction/substitution failed:
souvenirs.cpp:25:16: note:   'std::pair<std::vector<int>, long long int>' is not derived from 'const std::valarray<_Tp>'
   25 |     for(auto x:res)rem[x]--;
      |                ^~~
souvenirs.cpp:25:16: error: no matching function for call to 'end(std::pair<std::vector<int>, long long int>&)'
In file included from /usr/include/c++/11/utility:76,
                 from souvenirs.h:1,
                 from souvenirs.cpp:1:
/usr/include/c++/11/initializer_list:101:5: note: candidate: 'template<class _Tp> constexpr const _Tp* std::end(std::initializer_list<_Tp>)'
  101 |     end(initializer_list<_Tp> __ils) noexcept
      |     ^~~
/usr/include/c++/11/initializer_list:101:5: note:   template argument deduction/substitution failed:
souvenirs.cpp:25:16: note:   'std::pair<std::vector<int>, long long int>' is not derived from 'std::initializer_list<_Tp>'
   25 |     for(auto x:res)rem[x]--;
      |                ^~~
In file included from /usr/include/c++/11/vector:69,
                 from souvenirs.h:2,
                 from souvenirs.cpp:1:
/usr/include/c++/11/bits/range_access.h:71:5: note: candidate: 'template<class _Container> constexpr decltype (__cont.end()) std::end(_Container&)'
   71 |     end(_Container& __cont) -> decltype(__cont.end())
      |     ^~~
/usr/include/c++/11/bits/range_access.h:71:5: note:   template argument deduction/substitution failed:
/usr/include/c++/11/bits/range_access.h: In substitution of 'template<class _Container> constexpr decltype (__cont.end()) std::end(_Container&) [with _Container = std::pair<std::vector<int>, long long int>]':
souvenirs.cpp:25:16:   required from here
/usr/include/c++/11/bits/range_access.h:71:48: error: 'struct std::pair<std::vector<int>, long long int>' has no member named 'end'
   71 |     end(_Container& __cont) -> decltype(__cont.end())
      |                                         ~~~~~~~^~~
/usr/include/c++/11/bits/range_access.h:81:5: note: candidate: 'template<class _Container> constexpr decltype (__cont.end()) std::end(const _Container&)'
   81 |     end(const _Container& __cont) -> decltype(__cont.end())
      |     ^~~
/usr/include/c++/11/bits/range_access.h:81:5: note:   template argument deduction/substitution failed:
/usr/include/c++/11/bits/range_access.h: In substitution of 'template<class _Container> constexpr decltype (__cont.end()) std::end(const _Container&) [with _Container = std::pair<std::vector<int>, long long int>]':
souvenirs.cpp:25:16:   required from here
/usr/include/c++/11/bits/range_access.h:81:54: error: 'const struct std::pair<std::vector<int>, long long int>' has no member named 'end'
   81 |     end(const _Container& __cont) -> decltype(__cont.end())
      |                                               ~~~~~~~^~~
/usr/include/c++/11/bits/range_access.h:100:5: note: candidate: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::end(_Tp (&)[_Nm])'
  100 |     end(_Tp (&__arr)[_Nm]) noexcept
      |     ^~~
/usr/include/c++/11/bits/range_access.h:100:5: note:   template argument deduction/substitution failed:
souvenirs.cpp:25:16: note:   mismatched types '_Tp [_Nm]' and 'std::pair<std::vector<int>, long long int>'
   25 |     for(auto x:res)rem[x]--;
      |                ^~~
In file included from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:95,
                 from souvenirs.cpp:2:
/usr/include/c++/11/valarray:1239:5: note: candidate: 'template<class _Tp> _Tp* std::end(std::valarray<_Tp>&)'
 1239 |     end(valarray<_Tp>& __va) noexcept
      |     ^~~
/usr/include/c++/11/valarray:1239:5: note:   template argument deduction/substitution failed:
souvenirs.cpp:25:16: note:   'std::pair<std::vector<int>, long long int>' is not derived from 'std::valarray<_Tp>'
   25 |     for(auto x:res)rem[x]--;
      |                ^~~
In file included from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:95,
                 from souvenirs.cpp:2:
/usr/include/c++/11/valarray:1255:5: note: candidate: 'template<class _Tp> const _Tp* std::end(const std::valarray<_Tp>&)'
 1255 |     end(const valarray<_Tp>& __va) noexcept
      |     ^~~
/usr/include/c++/11/valarray:1255:5: note:   template argument deduction/substitution failed:
souvenirs.cpp:25:16: note:   'std::pair<std::vector<int>, long long int>' is not derived from 'const std::valarray<_Tp>'
   25 |     for(auto x:res)rem[x]--;
      |                ^~~