Submission #1092499

#TimeUsernameProblemLanguageResultExecution timeMemory
1092499alexander707070Gap (APIO16_gap)C++14
70 / 100
46 ms7412 KiB
#include<bits/stdc++.h> #include "gap.h" #define MAXN 600007 using namespace std; const long long inf=1e18; long long *l,*r,*ll,*rr; long long d,ans; vector<long long> v; long long findGap(int T, int N){ l=new long long(); r=new long long(); MinMax(1, inf, l,r); if(T==1){ v.push_back(*l); v.push_back(*r); for(int i=1;i<=N;i++){ ll=new long long(); rr=new long long(); MinMax((*l)+1,(*r)-1,ll,rr); if((*ll)==-1)break; v.push_back(*ll); v.push_back(*rr); l=ll; r=rr; } sort(v.begin(),v.end()); for(int i=0;i<v.size()-1;i++){ ans=max(ans,v[i+1]-v[i]); } return ans; } d=ans=(long long) (*r-*l)/(N-1); while(*l!=*r){ while(true){ ll=new long long(); rr=new long long(); MinMax((*l)+1,(*l)+d+1,ll,rr); if((*ll)!=-1)break; d*=2; } ans=max(ans,*ll-*l); d=ans; l=rr; } return ans; }

Compilation message (stderr)

gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:41:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   41 |   for(int i=0;i<v.size()-1;i++){
      |               ~^~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...