Submission #1096908

#TimeUsernameProblemLanguageResultExecution timeMemory
1096908NewtonabcGap (APIO16_gap)C++14
0 / 100
3104 ms524288 KiB
#include "gap.h" #include<bits/stdc++.h> using namespace std; stack<long long> st; vector<long long> arr; long long findGap(int T, int N) { long long ans=LLONG_MIN; long long l=-1,r=1e18+1,mn,mx; while(l+1<=r-1){ MinMax(l+1,r-1,&mn,&mx); if(mn==-1) break; arr.push_back(mn); if(mn!=mx) st.push(mx); } while(!st.empty()) arr.push_back(st.top()),st.pop(); for(int i=0;i<N-1;i++){ ans=max(ans,arr[i+1]-arr[i]); } /*for(int i=0;i<N;i++) cout<<arr[i] <<" "; cout<<"\n\n";*/ return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...