Submission #300090

#TimeUsernameProblemLanguageResultExecution timeMemory
300090a_playerGap (APIO16_gap)C++14
Compilation error
0 ms0 KiB
#include "gap.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; long long findGap(int T, int N){ if(T==1){ ll mx, mn; vector<ll> a(N); MinMax(0,2e18,&mn,&mx); a[0]=mn; a[N-1]=mx; int i=1; while(mx!=mn){ MinMax(mn+1,mx-1,&mn,&mx); if(mn==-1)break; a[i]=mn; a[N-i-1]=mx; i++; } ll ans=0; for(int i=1;i<N;i++)ans=max(ans,a[i]-a[i-1]); cout<<ans; return 0; } ll mn,mx; MinMax(0,2e18,&mn,&mx); ll d=(mx-mn+N-1)/N; ll a=mn+1; ll b=mn+d; ll l=mn; ll ans=0; for(int i=0;i<N;i++){ if(b>=mx)b=mx-1; if(s>e)break; ll mnn,mxx; MinMax(a,b,&mnn,&mxx); if(mnn!=-1){ ans=max(ans,mnn-l); l=mxx; } a+=d; b+=d; } ans=max(ans,mx-l); cout<<ans; return 0; }

Compilation message (stderr)

gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:35:8: error: 's' was not declared in this scope
   35 |     if(s>e)break;
      |        ^
gap.cpp:35:10: error: 'e' was not declared in this scope
   35 |     if(s>e)break;
      |          ^