# | 제출 시각UTC-0 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
744961 | amirhoseinfar1385 | Gap (APIO16_gap) | C++17 | 47 ms | 1868 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
#include "gap.h"
using namespace std;
long long findGap(int T, int N)
{
if(T==1||N<=8){
vector<long long>all(N);
long long mn=-1,mx=((long long)1e18+5),fmn=0,fmx=0;
//cout<<mx<<"\n";
int last=N-1,first=0;
while(last>=first){
MinMax(mn+1,mx-1,&fmn,&fmx);
//cout<<first<<" "<<last<<" "<<mn+1<<" "<<mx-1<<" "<<fmn<<" "<<fmx<<'\n';
mn=fmn;
mx=fmx;
all[last]=mx;
all[first]=mn;
last--;
first++;
}
long long res=0;
for(int i=1;i<N;i++){
// cout<<all[i]<<" "<<all[i-1]<<'\n';
res=max(res,all[i]-all[i-1]);
}
return res;
}
else{
long long res=1;
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |