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 <cstdio>
#include <algorithm>
#include <vector>
using namespace std;
long long findGap(int T, int N){
vector<long long> v;
long long small,big;
MinMax(0,1000000000000000000,&small,&big);
long long gap=(big-small)/((long long) N-1);
long long si=small,se=small+(gap++);
long long mn,mx;
while (si<=big){
MinMax(si,se,&mn,&mx);
if(mn!=-1){
v.push_back(mn);
if (mx!=mn) v.push_back(mx);
}
si+=gap,se+=gap;
}
long long maximal=0;
for (int it=1;it<v.size();it++){
maximal=max(maximal,v[it]-v[it-1]);
}
return maximal;
}
Compilation message (stderr)
gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:23:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for (int it=1;it<v.size();it++){
~~^~~~~~~~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |