| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 521143 | Jomnoi | Gap (APIO16_gap) | C++17 | 59 ms | 3192 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 <bits/stdc++.h>
#include "gap.h"
#define DEBUG 0
using namespace std;
const long long INF = 1e18;
long long findGap(int T, int N) {
vector <long long> a;
if(T == 1) {
a.resize(N);
MinMax(0, INF, &a[0], &a[N - 1]);
int l = 1, r = N - 2;
while(l <= r) {
MinMax(a[l - 1] + 1, a[r + 1] - 1, &a[l], &a[r]);
l++;
r--;
}
}
else {
long long L, R;
MinMax(0, INF, &L, &R);
long long minimum = (R - L + N - 2) / (N - 1);
a.push_back(L);
L++;
while(L < R) {
long long nL, nR;
MinMax(L, min(L + minimum, R - 1), &nL, &nR);
if(nL != -1 and nR != -1) {
a.push_back(nL);
a.push_back(nR);
}
L = min(L + minimum, R - 1) + 1;
}
a.push_back(R);
}
long long ans = 0;
for(int i = 1; i < a.size(); i++) {
ans = max(ans, a[i] - a[i - 1]);
}
return ans;
}Compilation message (stderr)
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
