Submission #1287507

#TimeUsernameProblemLanguageResultExecution timeMemory
1287507khoavn2008Gap (APIO16_gap)C++17
30 / 100
31 ms3240 KiB
#ifndef KHOA #include "gap.h" #endif // KHOA #include <bits/stdc++.h> using namespace std; #define ll long long #define ld double #define FOR(i,l,r) for(int i = (l), _r = (r); i <= _r; i++) #define FORNG(i,r,l) for(int i = (r), _l = (l); i >= _l; i--) #define REP(i,r) for(int i = 0, _r = (r); i < _r; i++) #define endl '\n' #define fi first #define se second #define pb push_back #define all(v) (v).begin(),(v).end() #define size(v) ((ll)(v).size()) #define MASK(x) (1LL << (x)) #define BIT(x, i) (((x) >> (i)) & 1) const ll MOD = 1e9 + 7, N = 2e5 + 10, INF = 2e18, LOG = 21; ll a[N]; #ifdef KHOA ll A[N] = {-2008, }; void MinMax(ll x,ll y,ll *z,ll *t){ bool ok = 0; FOR(i,1,10){ if(x <= a[i] && !ok){ *z = a[i]; ok = 1; } if(a[i] <= y)*t = a[i]; } } #endif ll findGap(int T, int n){ ll l = 0, r = 1e18; for(int head = 1, tail = n; head <= tail; head++, tail--){ ll L,R; MinMax(l, r, &L, &R); l = L; r = R; a[head] = l; a[tail] = r; l++,r--; } ll ans = -INF; FOR(i,1,n - 1)ans = max(ans, a[i + 1] - a[i]); return ans; } #ifdef KHOA int main(){ FOR(i,1,10)a[i] = i * 10,cerr<<a[i]<<' '; cerr<<endl; cout<<findGap(1, 10); } #endif
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...