This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
#define ll long long
#define ff first
#define ss second
#define pb push_back
using namespace std;
//#include "game.h"
#include "gap.h"
ll answer = 0;
long long findGap(int T, int N)
{
ll pirveli, bolo;
//MinMax(1,1e18,&pirveli,&bolo);
//cout << pirveli << " " << bolo << endl;
//solve(pirveli,bolo);
ll l = 1, r = 1e18;
int cnt = 0;
//if(T == 1)
while(true){
ll new_l,new_r;
cnt++;
if(cnt > (N+1)/2){
if(l != r){
answer = max(answer,r-l);
}
break;
}
if(l+1 > r-1){
if(l == r) break;
answer = max(answer,r-l);
break;
}
MinMax(l+1,r-1,&new_l,&new_r);
if(new_l == -1){
answer = max(answer,r-l);
break;
} else {
if(r != 1e18)answer = max(answer, max(new_l-l,r-new_r));
l = new_l;
r = new_r;
}
}
return answer;
}
Compilation message (stderr)
gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:18:8: warning: unused variable 'pirveli' [-Wunused-variable]
18 | ll pirveli, bolo;
| ^~~~~~~
gap.cpp:18:17: warning: unused variable 'bolo' [-Wunused-variable]
18 | ll pirveli, bolo;
| ^~~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |