| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 959992 | kim | Gap (APIO16_gap) | C++17 | 39 ms | 4252 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "gap.h"
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
#define eb emplace_back
long long findGap(int T, int N)
{
if(T==1){
ll a=1,b=1e18;
vector<ll> vec;
for(int i=0;i<N+1>>1;++i){
MinMax(a,b,&a,&b);
if(a==b) vec.eb(a);
else vec.eb(a++), vec.eb(b--);
}
sort(vec.begin(),vec.end());
ll ans=0;
for(int i=1;i<vec.size();++i) ans=max(ans,vec[i]-vec[i-1]);
return ans;
}
ll a,b,c,d;
MinMax(1,1e18,&a,&b);
if(N==2) return b-a;
ll ans=(b-a+N-2)/(N-1);
while(a+ans<b){
MinMax(a+1,a+ans,&c,&d);
if(d!=-1) a=d;
else{
MinMax(a+1,b,&c,&d);
ans=c-a;
a=c;
}
}
return ans;
}
컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
