Submission #200720

#TimeUsernameProblemLanguageResultExecution timeMemory
200720NordwayGap (APIO16_gap)C++14
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include "gap.h" #define x first #define y second #define pb push_back #define mp make_pair #define all(v) v.begin(),v.end() #define sz(v) (int)v.size() #define up_b upper_bound #define low_b lower_bound using namespace std; using namespace __gnu_pbds; typedef long long ll; typedef long double ld; typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set; template<class T,int SZ> struct BIT{ T t[SZ]; void upd(int x,T y){ for(int i=x;i<SZ;i=(i|(i+1))){ t[i]+=y; } } T pref(int x){ T res=0; for(int i=x;i>=0;i=(i&(i+1))-1){ res+=t[i]; } return res; } T get(int l,int r){ return pref(r)-pref(l-1); } }; template<class T,int SZ> struct ST{ T t[4*SZ]; void build(T a[],int v,int tl,int tr){ if(tl==tr){ t[v]=a[tl]; return ; } int tm=(tl+tr)/2; build(a,v*2,tl,tm); build(a,v*2+1,tm+1,tr); t[v]=t[v*2]+t[v*2+1]; } void upd(int v,int tl,int tr,int pos,T val){ if(tl==tr){ t[v]+=val; return ; } int tm=(tl+tr)/2; if(pos<=tm)upd(v*2,tl,tm,pos,val); else upd(v*2+1,tm+1,tr,pos,val); t[v]=t[v*2]+t[v*2+1]; } T get(int v,int tl,int tr,int l,int r){ if(tl>r||l>tr)return 0; if(l<=tl&&tr<=r)return t[v]; int tm=(tl+tr)/2; return get(v*2,tl,tm,l,r)+get(v*2+1,tm+1,tr,l,r); } }; const int N=1e5+11; const int M=1e3+11; const int W=1e3+11; const int inf=INT_MAX; const ll INF=1e18; const ll mod=1e9+7; const ld EPS=1e-9; const int dx[4]={0,0,1,-1}; const int dy[4]={1,-1,0,0}; ll a[N]; pair<ll,pair<ll,ll>>solve(ll l,ll r){ if(l>r)return mp(0,mp(-1,-1)); ll mn=l,mx=r; MinMax(l,r,&mn,&mx); if(mn==-1&&mx==-1)return mp(0,mp(-1,-1)); ll mid=(mx+mn)/2; pair<ll,pair<ll,ll>>L=solve(mn+1,mid); pair<ll,pair<ll,ll>>R=solve(mid+1,mx-1); ll res=max(L.x,R.x); if(L.y.x!=-1)res=max(res,L.y.x-mn); else if(R.y.x!=-1)res=max(R.y.x-mn); if(R.y.y!=-1)res=max(res,mx-R.y.y); else if(L.y.y!=-1)res=max(res,mx-L.y.y); if(L.y.y!=-1&&R.y.x!=-1)res=max(res,R.y.x-L.y.y); return mp(res,mp(mn,mx)); } ll findGap(int T,int n){ ll l=0,r=INF; ll mn,mx; MinMax(l,r,&mn,&mx); ll ans; if(n==2)ans=mx-mn; else{ pair<ll,pair<ll,ll>>p=solve(mn+1,mx-1); ans=p.x; ans=max(ans,max(p.y.x-mn,mx-p.y.y)); } return ans; }

Compilation message (stderr)

gap.cpp: In function 'std::pair<long long int, std::pair<long long int, long long int> > solve(ll, ll)':
gap.cpp:91:37: error: no matching function for call to 'max(long long int)'
   else if(R.y.x!=-1)res=max(R.y.x-mn);
                                     ^
In file included from /usr/include/c++/7/bits/char_traits.h:39:0,
                 from /usr/include/c++/7/ios:40,
                 from /usr/include/c++/7/istream:38,
                 from /usr/include/c++/7/sstream:38,
                 from /usr/include/c++/7/complex:45,
                 from /usr/include/c++/7/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:52,
                 from gap.cpp:1:
/usr/include/c++/7/bits/stl_algobase.h:219:5: note: candidate: template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)
     max(const _Tp& __a, const _Tp& __b)
     ^~~
/usr/include/c++/7/bits/stl_algobase.h:219:5: note:   template argument deduction/substitution failed:
gap.cpp:91:37: note:   candidate expects 2 arguments, 1 provided
   else if(R.y.x!=-1)res=max(R.y.x-mn);
                                     ^
In file included from /usr/include/c++/7/bits/char_traits.h:39:0,
                 from /usr/include/c++/7/ios:40,
                 from /usr/include/c++/7/istream:38,
                 from /usr/include/c++/7/sstream:38,
                 from /usr/include/c++/7/complex:45,
                 from /usr/include/c++/7/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:52,
                 from gap.cpp:1:
/usr/include/c++/7/bits/stl_algobase.h:265:5: note: candidate: template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)
     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
     ^~~
/usr/include/c++/7/bits/stl_algobase.h:265:5: note:   template argument deduction/substitution failed:
gap.cpp:91:37: note:   candidate expects 3 arguments, 1 provided
   else if(R.y.x!=-1)res=max(R.y.x-mn);
                                     ^
In file included from /usr/include/c++/7/algorithm:62:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:65,
                 from gap.cpp:1:
/usr/include/c++/7/bits/stl_algo.h:3462:5: note: candidate: template<class _Tp> constexpr _Tp std::max(std::initializer_list<_Tp>)
     max(initializer_list<_Tp> __l)
     ^~~
/usr/include/c++/7/bits/stl_algo.h:3462:5: note:   template argument deduction/substitution failed:
gap.cpp:91:37: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   else if(R.y.x!=-1)res=max(R.y.x-mn);
                                     ^
In file included from /usr/include/c++/7/algorithm:62:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:65,
                 from gap.cpp:1:
/usr/include/c++/7/bits/stl_algo.h:3468:5: note: candidate: template<class _Tp, class _Compare> constexpr _Tp std::max(std::initializer_list<_Tp>, _Compare)
     max(initializer_list<_Tp> __l, _Compare __comp)
     ^~~
/usr/include/c++/7/bits/stl_algo.h:3468:5: note:   template argument deduction/substitution failed:
gap.cpp:91:37: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   else if(R.y.x!=-1)res=max(R.y.x-mn);
                                     ^