Submission #1110453

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
11104532024-11-09 13:42:00TitanicXDzzGap (APIO16_gap)C++17
0 / 100
41 ms2868 KiB
#include "gap.h"
#include<bits/stdc++.h>
using namespace std;
long long findGap(int T, int n)
{
long long s=-1;
long long t=1e18+1;
long long x=-1;
long long y=-1;
long long maxi=LLONG_MIN;
for(int i=1;i<=n/2;i++){
MinMax(s+1,t-1,&s,&t);
if(i!=1){
maxi=max(maxi,s-x);
maxi=max(maxi,y-t);
}
x=s;
y=t;
}
if(n%2==0){
maxi=max(maxi,y-x);
}
else{
MinMax(s+1,t-1,&s,&t);
maxi=max(maxi,s-x);
maxi=max(maxi,y-s);
}
return maxi;
}
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...