#include <iostream>
#include <chrono>
#include <vector>
#include <algorithm>
#include "gap.h"
#define maxn 200005
#define maxlog 20
#define INF 1000000010
#define LINF 1000000000000000005
#define endl '\n'
#define pb(x) push_back(x)
#define X first
#define Y second
#define control cout<<"passed"<<endl;
#pragma GCC optimize("O3" , "Ofast" , "unroll-loops" , "fast-math")
#pragma GCC target("avx2")
using namespace std;
std::chrono::high_resolution_clock::time_point startT, currT;
constexpr double TIME_MULT = 1;
double timePassed()
{
using namespace std::chrono;
currT = high_resolution_clock::now();
double time = duration_cast<duration<double>>(currT - startT).count();
return time * TIME_MULT;
}
vector <long long> nums;
/**void MinMax(long long l , long long r , long long &mn , long long &mx)
{
cout << l << " " << r << endl;
int a , b;
cin >> a >> b;
mn = a;
mx = b;
}*/
long long task1(int n)
{
long long l = 1;
long long r = LINF;
int q = ((n + 1) / 2);
while(q--)
{
long long mn, mx;
MinMax(l, r, &mn, &mx);
nums.pb(mn);
nums.pb(mx);
l = mn + 1;
r = mx - 1;
}
sort(nums.begin(), nums.end());
reverse(nums.begin(), nums.end());
/**for(int e : nums)
cout << e << " ";
cout << endl;*/
long long ans = 0;
for(int i = 1; i < (int)(nums.size()); i++)
ans = max(ans, abs(nums[i] - nums[i - 1]));
return ans;
}
long long findGap(int t, int n)
{
if(t == 1)
return task1();
long long l = 1;
long long r = LINF;
long long maxx = -1;
long long minn = LINF;
MinMax(1LL, LINF, &minn, &maxx);
long long step = (maxx - minn + n) / n;
l = minn;
r = maxx;
nums.pb(minn);
for(long long i = l; i < r; i += step)
{
long long to = min(r - 1, i + step);
MinMax(i + 1, to, &minn, &maxx);
if(minn == -1 && maxx == -1)
continue;
nums.pb(minn);
nums.pb(maxx);
}
nums.pb(r);
//sort(nums.begin() , nums.end());
//reverse(nums.begin() , nums.end());
long long ans = -1;
for(int i = 1; i < (int)(nums.size()); i++)
ans = max(ans, abs(nums[i] - nums[i - 1]));
return ans;
}
/**int main()
{
int t , n;
cin >> t >> n;
cout << findGap(t , n) << endl;;
return 0;
}*/
Compilation message
gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:92:22: error: too few arguments to function 'long long int task1(int)'
92 | return task1();
| ^
gap.cpp:49:11: note: declared here
49 | long long task1(int n)
| ^~~~~