제출 #488196

#제출 시각아이디문제언어결과실행 시간메모리
488196PixelCatMinerals (JOI19_minerals)C++14
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #include "minerals.h" using namespace std; #define For(i,a,b) for(int i=a;i<=b;i++) #define eb emplace_back #define all(x) x.begin(),x.end() #define sz(x) ((int)x.size()) bool toggle(int x){ static int last=0; int now=Query(x); bool ans=(now==last); last=now; return ans; } void solve(vector<int> &vl,vector<int> &vr,int l,int r,bool fill){ if(sz(vl)==1){ Answer(vl[0],vr[l]); return; } int n=max(1ll,sz(vl)/3); int m=sz(vl)-n; For(i,l,l+n-1) toggle(vr[i]); vector<int> vll,vlr; for(auto &i:vl){ if(sz(vll)==n) vlr.eb(i); else if(sz(vlr)==m) vll.eb(i); else{ bool res=toggle(i); if(fill!=res) vll.eb(i); else vlr.eb(i); } } solve(vll,vr,l,l+n-1,!fill); solve(vlr,vr,l+n,r,fill); } void Solve(int32_t n){ vector<int> l,r; For(i,1,n*2){ if(toggle(i)) l.eb(i); else r.eb(i); } random_shuffle(all(r)); solve(l,r,0,n-1,true); }

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

minerals.cpp: In function 'void solve(std::vector<int>&, std::vector<int>&, int, int, bool)':
minerals.cpp:22:24: error: no matching function for call to 'max(long long int, int)'
   22 |  int n=max(1ll,sz(vl)/3);
      |                        ^
In file included from /usr/include/c++/10/bits/char_traits.h:39,
                 from /usr/include/c++/10/ios:40,
                 from /usr/include/c++/10/istream:38,
                 from /usr/include/c++/10/sstream:38,
                 from /usr/include/c++/10/complex:45,
                 from /usr/include/c++/10/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54,
                 from minerals.cpp:1:
/usr/include/c++/10/bits/stl_algobase.h:254:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  254 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/10/bits/stl_algobase.h:254:5: note:   template argument deduction/substitution failed:
minerals.cpp:22:24: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   22 |  int n=max(1ll,sz(vl)/3);
      |                        ^
In file included from /usr/include/c++/10/bits/char_traits.h:39,
                 from /usr/include/c++/10/ios:40,
                 from /usr/include/c++/10/istream:38,
                 from /usr/include/c++/10/sstream:38,
                 from /usr/include/c++/10/complex:45,
                 from /usr/include/c++/10/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54,
                 from minerals.cpp:1:
/usr/include/c++/10/bits/stl_algobase.h:300:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  300 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/10/bits/stl_algobase.h:300:5: note:   template argument deduction/substitution failed:
minerals.cpp:22:24: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   22 |  int n=max(1ll,sz(vl)/3);
      |                        ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from minerals.cpp:1:
/usr/include/c++/10/bits/stl_algo.h:3480:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(std::initializer_list<_Tp>)'
 3480 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/10/bits/stl_algo.h:3480:5: note:   template argument deduction/substitution failed:
minerals.cpp:22:24: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   22 |  int n=max(1ll,sz(vl)/3);
      |                        ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from minerals.cpp:1:
/usr/include/c++/10/bits/stl_algo.h:3486:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(std::initializer_list<_Tp>, _Compare)'
 3486 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/10/bits/stl_algo.h:3486:5: note:   template argument deduction/substitution failed:
minerals.cpp:22:24: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   22 |  int n=max(1ll,sz(vl)/3);
      |                        ^