#include <bits/stdc++.h>
#include "gap.h"
using namespace std;
//#define int long long
#define OYY LLONG_MAX
#define faster ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define fi first
#define se second
#define FOR for(int i=1;i<=n;i++)
#define mid (start+end)/2
#define pb push_back
#define lim 200005
typedef long long lo;
//~ inline void MinMax(lo xx,lo yy,lo &x,lo &y){
//~ cout<<xx<<" "<<yy<<endl;
//~ lo a,b;cin>>a>>b;
//~ x=a,y=b;
//~ }
long long findGap(int T, int N){
int r=N;
lo cur_l=0,cur_r=OYY;
lo dizi[N+1];
for(int l=1;l<=N;l++){
lo mn,mx;
MinMax(cur_l,cur_r,&mn,&mx);
if(l>r)break;
dizi[l++]=mn;
dizi[r--]=mx;
cur_l=mn;
cur_r=mx;
}
lo cev=0;
for(int i=2;i<=N;i++){
cev=max(cev,dizi[i]-dizi[i-1]);
}
return cev;
}
//~ int main(){
//~ faster
//~ int t,n;cin>>t>>n;
//~ cout<<findGap(t,n)<<'\n';
//~ return 0;
//~ }
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |