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 <bits/stdc++.h>
#include "gap.h"
using namespace std;
vector<long long>a;
void rec(long long l,long long r){
long long c,v;
MinMax(l,r,&c,&v);
if(c==-1)return;
a.push_back(c);if(c!=v)a.push_back(v);
if(c==v||c==v-1)return;
rec(l+1,(l+r)/2);rec((l+r)/2+1,r);
}
long long findGap(int q,int x){
rec(0,1e18);
long long ret=0;
for(int i=0;i<x-1;i++)ret=max(ret,a[i+1]-a[i]);
return ret;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |