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