# | 제출 시각UTC-0 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
254853 | maximath_1 | Gap (APIO16_gap) | C++11 | 72 ms | 1960 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
/*
* APIO 2016 Gap
* T = 1
> Two pointers, left right approaching the center
* T = 2
> pigeon hole principle
> get minimum and maximum,
> then divide the array into n - 1 approx. equal parts
> By PHP, one of these parts will be empty
> Thus, maximum gap >= the length of a part
> Now we can simply compare with seg[i].left - seg[i - 1].right
*/
#include "gap.h"
#include <iostream>
using namespace std;
#define ll long long
const ll mn = 0ll, mx = 1e18;
ll res = mn, arr[100005];
ll findGap(int t, int n){
if(t == 1){
ll lf = mn, rg = mx, k = 0;
for(int i = n; i > 0; i -= 2){
MinMax(lf, rg, &arr[k], &arr[n - 1 - k]);
lf = arr[k] + 1;
rg = arr[n - 1 - k] - 1;
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |