Submission #523801

#TimeUsernameProblemLanguageResultExecution timeMemory
523801vonatlusGap (APIO16_gap)C++17
30 / 100
50 ms1900 KiB
#include "gap.h"

#pragma GCC optimize("O3")
//#pragma comment(linker, "/STACK:36777216")

#include<bits/stdc++.h>

#define x first
#define y second
#define pb push_back
#define sz(x) (int) x.size()
#define all(z) (z).begin(), (z).end()
 
using namespace std;

using ll = long long;
using pii = pair<int, int>;                                   

const int MOD = 1e9 + 7; 
const int INF = 1e9 + 1e2;
  
long long findGap(int T, int n) {
    vector<ll> a(n);
    ll l = 0, r = 1e18;
    for (int i = 0; i < (n+1)/2; ++i) {
        ll nl, nr;
        MinMax(l, r, &nl, &nr);
        a[i] = nl;
        a[n-i-1] = nr;
        l = a[i]+1, r = a[n-i-1]-1;
    }
    ll ans = 0;
    for (int i = 1; i < n; ++i) {
        ans = max(ans, a[i]-a[i-1]);
    }
    return ans;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...