# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
106813 | someone_aa | Gap (APIO16_gap) | C++17 | 75 ms | 2500 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>
#define ll long long
#define pb push_back
using namespace std;
long long findGap(int T, int N)
{
ll low = -1;
ll high = 1e18 + 1;
ll mn = -1, mx = -1;
vector<ll>v;
while(v.size() < N) {
MinMax(low, high, &mn, &mx);
if(mn != mx) {
v.pb(mn);
v.pb(mx);
}
else {
v.pb(mn);
break;
}
low = mn + 1;
high = mx - 1;
}
sort(v.begin(), v.end());
ll result = 0LL;
for(int i=1;i<v.size();i++) {
result = max(result, v[i] - v[i-1]);
}
return result;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |