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>
#define pb push_back
using namespace std;
using ll = long long;
long long findGap(int T, int N)
{
ll l = 0, r = 1e18, mn, mx, tl, tr;
MinMax(l, r, &mn, &mx);
ll step = (mx-mn+N-1)/N;
l = 0, r = step;
ll ans = 0;
vector<ll> x;
while(true) {
MinMax(l, r, &tl, &tr);
x.pb(tl);
x.pb(tr);
if(r==mx)break;
l+=step;
r+=step;
r = min(r, mx);
}
for(int i = 1; i < x.size(); i++)
ans = max(ans, x[i]-x[i-1]);
return ans;
}
Compilation message (stderr)
gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:23:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int i = 1; i < x.size(); i++)
~~^~~~~~~~~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |