이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "gap.h"
#include <bits/stdc++.h>
using namespace std;
long long findGap(int T, int N)
{
//MinMax(3,5,*l,*h)
if(T == 1){
long long pl, ph, nl, nh;
MinMax(0,1000000000000000000, &pl, &ph);
long long best = 0;
for(int i = 1; i < (N+1)/2; i++){
MinMax(pl+1, ph-1, &nl,&nh);
best = max(ph-nh, best);
best = max(nl-pl, best);
}
return best;
}else{
long long best = 0;
long long mx, mn;
MinMax(0, 1000000000000000000, &mn, &mx);
long long cur = mn;
long long interval = (mx-mn-1)/(N-1)+1;
for(long long a = mn+1; a < mx; a += interval){
long long l, h;
MinMax(a, min(a + interval-1, mx-1), &l, &h);
if(l != -1){
best = max(best, l-cur);
cur = h;
}
}//*/
best = max(best, mx-cur);
return best;
}
}
/*
#include <bits/stdc++.h>
using namespace std;
long long findGap(int T, long long N){
//MinMax(3,5,*l,*h)
if(T == 1){
int pl, ph, nl, nh;
MinMax(0,1000000000000000000, *pl, *ph);
int best = 0;
for(int i = 1; i < (N+1)/2; i++){
MinMax(pl+1, ph-1, *nl, *nh);
best = max(ph-nh, best);
best = min(nl-pl, best);
}
return best;
}
}
*/
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |