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