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 "gap.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define PUB push_back
vector<ll>data;
ll MAX(ll a, ll b){
if(a > b) return a;
return b;
}
ll subtask1(int N){
ll l = 0,
r = pow(10,18);
ll respL, respR;
ll ans = 0;
while(data.size() < N){
MinMax(l, r, &respL, &respR);
l = respL+1;
r = respR-1;
data.PUB(respL);
if(respL != respR) data.PUB(respR);
}
sort(data.begin(), data.end());
for(int i=0;i<N-1;i++){
ans = MAX(ans, data[i+1]-data[i]);
}
return ans;
}
long long findGap(int T, int N)
{
if(T==1) return subtask1(N);
else return subtask1(N);
}
Compilation message (stderr)
gap.cpp: In function 'll subtask1(int)':
gap.cpp:22:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
while(data.size() < N){
~~~~~~~~~~~~^~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |