| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 367744 | abra_stone | Gap (APIO16_gap) | C++14 | 84 ms | 3424 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 <vector>
#include <algorithm>
using namespace std;
typedef long long ll;
ll ans;
vector<ll> a;
ll findGap(int T, int n) {
ll i, mn = 0, mx = 2e18;
if (T == 1) {
for (i = 0; i < n; i += 2) {
MinMax(mn, mx, &mn, &mx);
a.push_back(mn);
a.push_back(mx);
mn++;
mx--;
}
} else {
ll tmn, tmx;
MinMax(mn, mx, &mn, &mx);
a.push_back(mn);
a.push_back(mx);
ll t = (mx - mn + n - 2) / (n - 1);
mn++;
mx--;
for (i = mn; i <= mx; i += t + 1) {
MinMax(i, i + t, &tmn, &tmx);
a.push_back(tmn);
a.push_back(tmx);
}
}
sort(a.begin(), a.end());
for (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... | ||||
