Submission #44712

#TimeUsernameProblemLanguageResultExecution timeMemory
44712faustaadpGap (APIO16_gap)C++17
100 / 100
100 ms2584 KiB
#include "gap.h" #include<bits/stdc++.h> #define ll long long #define pb push_back #define mp make_pair #define fi first #define se second using namespace std; ll ma,L,R,gm,i,LT,RT,a[101010]; vector<ll> v; long long findGap(int T, int N) { if(T==1) { LT=-1; RT=1e18; RT++; for(i=1;i<=(N+1)/2;i++) { MinMax(LT+1,RT-1,&LT,&RT); a[i]=LT; a[N-i+1]=RT; } for(i=2;i<=N;i++) ma=max(ma,a[i]-a[i-1]); } else { MinMax(0,(ll)1e18,&L,&R); gm=(R-L)/(N-1); for(i=L;i<R;i+=(gm+1)) { MinMax(i,min(i+gm,R),&LT,&RT); if(LT!=-1) v.pb(LT); if(LT!=RT) v.pb(RT); } for(i=1;i<v.size();i++) ma=max(ma,v[i]-v[i-1]); } return ma; }

Compilation message (stderr)

gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:39:12: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(i=1;i<v.size();i++)
           ~^~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...