Submission #1113736

#TimeUsernameProblemLanguageResultExecution timeMemory
1113736simona1230Gap (APIO16_gap)C++17
0 / 100
47 ms6892 KiB
#include <bits/stdc++.h> #include "gap.h" using namespace std; long long n; vector<long long> v; void solve(long long l,long long r) { if(l>r)return; //cout<<l<<" "<<r<<" "<<ll<<" "<<rr<<endl; long long len=r-l+1; long long b=len; long long mn=0,mx=0; MinMax(l,r,&mn,&mx); if(mn==-1)return; v.push_back(mn); v.push_back(mx); solve(mn+1,mx-1); } long long findGap(int t,int N) { n=N; solve(0,1e18); long long ans=0; sort(v.begin(),v.end()); for(int i=1;i<v.size();i++) ans=max(ans,v[i]-v[i-1]); return ans; } /*int main() { long long d=0; int x; cin>>x>>nn; for(int i=1;i<=nn;i++) { cin>>a[i]; if(i!=1)d=max(d,a[i]-a[i-1]); } long long answer=findGap(1,nn); cout<<d<<" "<<answer<<endl; }*/

Compilation message (stderr)

gap.cpp: In function 'void solve(long long int, long long int)':
gap.cpp:13:15: warning: unused variable 'b' [-Wunused-variable]
   13 |     long long b=len;
      |               ^
gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:32:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   32 |     for(int i=1;i<v.size();i++)
      |                 ~^~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...