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;
vector<ll> v;
long long findGap(int T, int N) {
ll mx = 0;
if(T == 2){
ll lo,hi;
MinMax(1, 1e18, &lo, &hi);
v.push_back(lo);
v.push_back(hi);
ll big = hi;
ll sure = (hi-lo)/(N-1);
ll cur = lo;
while(cur < big){
MinMax(cur, cur+sure, &lo, &hi);
if(lo == -1){
cur = cur + sure;
continue;
}
v.push_back(lo);
v.push_back(hi);
cur = hi + 1;
}
sort(v.begin(),v.end());
for (int i = 0; i + 1 < v.size(); ++i){
mx = max(mx,abs(v[i]-v[i+1]));
}
}else{
}
return mx;
}
Compilation message (stderr)
gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:31:25: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for (int i = 0; i + 1 < v.size(); ++i){
^
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |