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>
using namespace std;
typedef long long ll;
vector<ll> v;
ll a = 0, 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, b, &a, &b);
v.push_back(a); v.push_back(b);
}
}
else{
MinMax(a, b, &a, &b);
c = b - a; N--;
for(int i = 0; i < N; i++){
MinMax(a + c / N * i + 1, a + c / N * (i + 1), &x, &y);
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:26: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... |