Submission #1227012

#TimeUsernameProblemLanguageResultExecution timeMemory
1227012cpdreamerGap (APIO16_gap)C++20
30 / 100
35 ms1940 KiB
#include "gap.h" #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> using namespace __gnu_pbds; using namespace std; const long long INF = 1e17; typedef long long ll; const ll MOD = 1e9+7; #define F first #define pb push_back #define S second #define P pair #define V vector #define all(v) v.begin(), v.end() long long findGap(int T, int N) { ll v1=0,v2=1e18; ll p1=0,p2=N-1; ll a[N]; while (p1<=p2) { ll mn,mx; MinMax(v1,v2,&mn,&mx); if (mn==-1) { break; } a[p1]=mn,a[p2]=mx; v1=mn+1,v2=mx-1; p1++,p2--; } ll ans=0; for (ll i=0;i<N-1;i++) { ans=max(ans,a[i+1]-a[i]); } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...