| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 529753 | happypotato | Gap (APIO16_gap) | C++17 | 45 ms | 1168 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
using namespace std;
ll mn, mx;
ll st1(int n) {
ll s = 0, t = 1e18;
MinMax(s, t, &mn, &mx);
ll ans = 0;
for (int i = 2; i <= n / 2; i++) {
ll pmn = mn, pmx = mx;
MinMax(mn + 1, mx - 1, &mn, &mx);
ans = max(ans, mn - pmn);
ans = max(ans, pmx - mx);
}
if (n % 2 == 1) {
ll fin, fin2;
MinMax(mn + 1, mx - 1, &fin, &fin2);
ans = max(ans, fin - mn);
ans = max(ans, mx - fin);
} else {
ans = max(ans, mx - mn);
}
return ans;
}
ll st2(int n) {
}
long long findGap(int T, int N) {
if (T == 1) return st1(N);
else return st1(N);
}Compilation message (stderr)
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
