| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 671098 | AdamGS | Gap (APIO16_gap) | C++17 | 56 ms | 2632 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;
typedef long long ll;
#define rep(a, b) for(int a = 0; a < (b); ++a)
#define pb push_back
#define all(a) a.begin(), a.end()
const ll INF=1e18;
ll findGap(int t, int n) {
if(t==2) {
ll mi, ma;
MinMax(0, INF, &mi, &ma);
ll x=(ma-mi+n-2)/(n-1), ans=x;
ll lst=mi;
for(ll i=mi; i<=ma; i+=x+1) {
ll a, b;
MinMax(i, i+x, &a, &b);
if(a==-1) continue;
ans=max(ans, a-lst);
lst=b;
}
return ans;
}
vector<ll>A, B;
ll mi=0, ma=INF;
rep(i, (n+1)/2) {
ll a, b;
MinMax(mi, ma, &a, &b);
if(a==-1) break;
A.pb(a);
B.pb(b);
mi=a+1;
ma=b-1;
}
reverse(all(B));
for(auto i : B) A.pb(i);
ll ans=0;
rep(i, A.size()-1) 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... | ||||
