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 <algorithm>
#include <cstdio>
using namespace std;
typedef long long ll;
vector<ll> v;
ll a = -1, b = (1LL << 62), c, x, y, ans;
ll findGap(int T, int N)
{
if(T == 1){
for(int i = 0; i < (N + 1) / 2; i++){
MinMax(a + 1, b - 1, &a, &b);
v.push_back(a); v.push_back(b);
}
}
else{
MinMax(a, b, &a, &b);
v.push_back(a); v.push_back(b);
c = b - a; N--;
c = (c + N - 1) / N;
for(int i = 0; i < N; i++){
ll q = a + c * i + 1;
ll w = a + c * (i + 1);
MinMax(q, w, &x, &y);
if(x == -1) continue;
v.push_back(x); v.push_back(y);
}
}
sort(v.begin(), v.end());
for(int i = 1; i < v.size(); i++) ans = max(ans, v[i] - v[i - 1]);
return ans;
}
Compilation message (stderr)
gap.cpp: In function 'll findGap(int, int)':
gap.cpp:32:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int i = 1; i < v.size(); i++) ans = max(ans, v[i] - v[i - 1]);
^
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |