이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "gap.h"
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define rt insert
#define st first
#define nd second
#define ll long long
#define pii pair < int , int >
#define DB printf("debug\n");
#define umax( x , y ) x = max( x , y )
#define umin( x , y ) x = min( x , y )
#define all(x) x.begin() , x.end()
using namespace std;
long long findGap(int T, int N)
{
if(T==1){
ll a[N];memset(a,0,sizeof(a));
ll l=0,r=N-1;
while(l<=r){
if(l==0 && r==N-1){
MinMax(0,1e18,&a[l],&a[r]);
}
else{
//printf("l=%d r=%d\n",l,r);
MinMax(a[l-1]+1,a[r+1]-1,&a[l],&a[r]);
//else MinMax(a[l-1]+1,1e18,&a[l],NULL);
}
l++,r--;
}
ll ans=0;
for(int i=0;i<N-1;i++){
//printf("i=%d a[i]=%lld a[i+1]=%lld\n",i,a[i],a[i+1]);
umax(ans,a[i+1]-a[i]);
}
return ans;
}
else if(T==2){
ll a[N];memset(a,0,sizeof(a));
ll l=0,r=N-1;
while(l<=r){
if(l==0 && r==N-1){
MinMax(0,1000000000000000000,&a[l],&a[r]);
}
else{
//printf("l=%d r=%d\n",l,r);
MinMax(a[l-1]+1,a[r+1]-1,&a[l],&a[r]);
//else MinMax(a[l-1]+1,1e18,&a[l],NULL);
}
l++,r--;
}
ll ans=0;
for(int i=0;i<N-1;i++){
//printf("i=%d a[i]=%lld a[i+1]=%lld\n",i,a[i],a[i+1]);
umax(ans,a[i+1]-a[i]);
}
return ans;
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |