Submission #744940

#TimeUsernameProblemLanguageResultExecution timeMemory
744940amirhoseinfar1385Gap (APIO16_gap)C++17
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> #include "gap.h" using namespace std; long long findGap(int T, int N) { if(T==1||n<=60){ vector<long long>all(N); long long mn=-1,mx=((long long)1e18+5),fmn=0,fmx=0; //cout<<mx<<"\n"; int last=N-1,first=0; while(last>=first){ MinMax(mn+1,mx-1,&fmn,&fmx); //cout<<first<<" "<<last<<" "<<mn+1<<" "<<mx-1<<" "<<fmn<<" "<<fmx<<'\n'; mn=fmn; mx=fmx; all[last]=mx; all[first]=mn; last--; first++; } long long res=0; for(int i=1;i<N;i++){ // cout<<all[i]<<" "<<all[i-1]<<'\n'; res=max(res,all[i]-all[i-1]); } return res; } else{ long long res=1; long long mn=-1,mx=((long long)1e18+5),fmn=0,fmx=0; MinMax(mn+1,mx-1,&fmn,&fmx); mn=fmn; mx=fmx; while(mn<mx){ MinMax(mn+res,mn+res+res,&fmn,&fmx); if(fmn==-1){ res*=2; res++; continue; } res=max(res,fmn-mn); mn=fmx; } return res; } }

Compilation message (stderr)

gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:7:11: error: 'n' was not declared in this scope
    7 |  if(T==1||n<=60){
      |           ^
gap.cpp:47:1: warning: control reaches end of non-void function [-Wreturn-type]
   47 | }
      | ^