#include <bits/stdc++.h>
#include "gap.h"
using namespace std;
#define ll long long
#define vi vector<int>
#define vs vector<string>
#define vvi vector<vector<long>>
#define ff first
#define endl '\n'
#define all(a) a.begin(),a.end()
#define ss second
#define pb push_back
#define eb emplace_back
#define sz(x) (int) x.size()
#define vpair vector<pair<int,int>>
#define MAX(a,b,c) max(a,max(b,c))
#define prev name
const int INF=1e9;
const int dx[4]={-1,0,1,0};
const int dy[4]={0,-1,0,1};
const long MAXN=1e18;
ll a[100000],j=0;
ll findGap(int T, int N)
{
if(T==1){
ll l=1,r=MAXN;
ll mn,mx;
vi v;
for(ll i=0;i<(N+1)>>1;++i)
{
MinMax(l,r,&mn,&mx);
a[j++]=mn;
a[j++]=mx;
l=mn+1,r=mx-1;
}
sort(a,a+N);
ll ans=0;
for(ll i=0;i<N;++i)
{
ans=max(ans,a[i+1]-a[i]);
}
return ans;
}
else{
ll mn,mx;
MinMax(1,MAXN,&mn,&mx);
ll s=(mx-mn+N-2)/(N-1);
ll ans=s,x,y,l=mn,i;
for(i=mn,i+s<mx;i+=s+1)
{
MinMax(i,i+s,&x,&y);
if(x!=-1)
{
ans=max(ans,x-l);
l=y;
}
}
MinMax(i,mx,&x,&y);
if(x!=-1)
{
ans=max(ans,x-l);
}
return ans;
}
}
Compilation message
gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:53:21: warning: right operand of comma operator has no effect [-Wunused-value]
53 | for(i=mn,i+s<mx;i+=s+1)
| ~~~^~~
gap.cpp:53:31: error: expected ';' before ')' token
53 | for(i=mn,i+s<mx;i+=s+1)
| ^
| ;