제출 #1316319

#제출 시각아이디문제언어결과실행 시간메모리
1316319ezzzay축제 (IOI25_festival)C++20
컴파일 에러
0 ms0 KiB
//#include "festival.h" #include<bits/stdc++.h> using namespace std; #define pb push_back #define ff first #define ss second #define ll long long std::vector<int> max_coupons(int A, std::vector<int> P, std::vector<int> T) { int N=P.size(); vector<vector<pair<int,int>>> v(5); for(int i=0;i<N;i++){ v[T[i]].pb({P[i],i}); } for(int i=1;i<=2;i++){ sort(v[i].begin(),v[i].end()); } // ps? vector<ll>ps((int)v[1].size()); if(v[1].size()>0){ ps[0]=v[1][0].ff; } for(int i=1;i<v[1].size();i++){ ps[i]=ps[i-1]+(ll)v[1][i].ff; } pair<int,int>cnt={-1,-1}; cnt.ff= upper_bound(ps.begin(),ps.end(),A)-ps.begin(); ll H=A; for(int i=0;i<v[2].size();i++){ if(v[2][i].ff>H)break; H-=v[2][i].ff; H*=2; H=min(H,1e17); int h= upper_bound(ps.begin(),ps.end(),H)-ps.begin(); cnt=max(cnt,{i+1+h,i+1}); } vector<int>ans; for(int i=0;i<cnt.ss;i++){ ans.pb(v[2][i].ss); } for(int i=0;i<cnt.ff-cnt.ss;i++){ ans.pb(v[1][i].ss); } return ans; }

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

festival.cpp: In function 'std::vector<int> max_coupons(int, std::vector<int>, std::vector<int>)':
festival.cpp:32:14: error: no matching function for call to 'min(long long int&, double)'
   32 |         H=min(H,1e17);
      |           ~~~^~~~~~~~
In file included from /usr/include/c++/13/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:51,
                 from festival.cpp:2:
/usr/include/c++/13/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/13/bits/stl_algobase.h:233:5: note:   template argument deduction/substitution failed:
festival.cpp:32:14: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'double')
   32 |         H=min(H,1e17);
      |           ~~~^~~~~~~~
/usr/include/c++/13/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/13/bits/stl_algobase.h:281:5: note:   template argument deduction/substitution failed:
festival.cpp:32:14: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'double')
   32 |         H=min(H,1e17);
      |           ~~~^~~~~~~~
In file included from /usr/include/c++/13/algorithm:61:
/usr/include/c++/13/bits/stl_algo.h:5775:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
 5775 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/13/bits/stl_algo.h:5775:5: note:   template argument deduction/substitution failed:
festival.cpp:32:14: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   32 |         H=min(H,1e17);
      |           ~~~^~~~~~~~
/usr/include/c++/13/bits/stl_algo.h:5785:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
 5785 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/13/bits/stl_algo.h:5785:5: note:   template argument deduction/substitution failed:
festival.cpp:32:14: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   32 |         H=min(H,1e17);
      |           ~~~^~~~~~~~