# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
68125 | shoemakerjo | Gap (APIO16_gap) | C++14 | 106 ms | 39864 KiB |
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;
#define ll long long
ll findGap(int T, int N)
{
ll lo, hi;
MinMax(1, 1000000000000000000LL, &lo, &hi);
ll alph = (hi-lo)/N;
if ((hi-lo)%N != 0) alph+=1LL;
vector<ll> nums; //all the ones we care about
ll st = lo+1LL;
nums.push_back(lo);
while (st <= hi) {
ll c1, c2;
MinMax(st, st+alph, &c1, &c2);
if (c1 != -1) {
nums.push_back(c1);
nums.push_back(c2);
}
st += alph+1LL;
}
ll ans = alph;
for (int i = 1; i < nums.size(); i++) {
ans = max(ans, nums[i]-nums[i-1]);
}
return ans;
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |