| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 534558 | pokmui9909 | Gap (APIO16_gap) | C++17 | 64 ms | 3276 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;
using ll = long long;
#define x first
#define y second
pair<ll, ll> ask(ll s, ll e){
pair<ll, ll> p;
MinMax(s, e, &p.x, &p.y);
return p;
}
long long findGap(int T, int N){
vector<ll> A;
if(T == 1){
ll L = 0, R = 2e18;
while(N >= 1){
pair<ll, ll> r = ask(L, R);
A.push_back(r.x);
A.push_back(r.y);
L = r.x + 1, R = r.y - 1;
N -= 2;
}
} else {
pair<ll, ll> r = ask(0, 1e18 + 5);
ll md = (r.y - r.x) / (N - 1) + 1;
for(ll i = r.x; i <= r.y; i += md + 1){
pair<ll, ll> p = ask(i, i + md);
A.push_back(p.x);
A.push_back(p.y);
}
}
sort(A.begin(), A.end());
ll ans = 0;
for(int i = 0; i < A.size() - 1; i++){
ans = max(ans, A[i + 1] - A[i]);
}
return ans;
}Compilation message (stderr)
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
