| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1341081 | aritro_ | Gap (APIO16_gap) | C++20 | 47 ms | 3240 KiB |
#include<bits/stdc++.h>
#include "gap.h"
using namespace std;
typedef long long ll;
#define pb push_back
ll MinMax(int s,int t,int a,int b);
ll findGap(int t,int n){
if(t==1){
ll l=-1,r=2e18;
vector<ll> a;
for(int i=0;i<(n+1)/2;i++){
MinMax(l+1,r-1,&l,&r);
a.pb(l);
if(l!=r) a.pb(r);
}
sort(a.begin(),a.end());
ll ans=0;
for(int i=0;i<n-1;i++) ans=max(ans,a[i+1]-a[i]);
return ans;
}else if(t==2){
ll ans=1;
ll l,r;
MinMax(1,1e18,&l,&r);
ll len=r-l;
ll gap=(len+n-2)/(n-1);
ans=max(gap, ans);
vector<ll> arr={l};
ll fir=l+1,sec=l+1+gap;
ll o,t;
while(fir<=r){
MinMax(fir,sec,&o,&t);
if(o!=-1) arr.pb(o);
if(t!=-1) arr.pb(t);
fir+=gap+1,sec+=gap+1;
}
for(int i=1;i<arr.size();i++) ans=max(ans,arr[i]-arr[i-1]);
return ans;
}
}컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
