| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1318587 | khanhphucscratch | Gap (APIO16_gap) | C++20 | 0 ms | 0 KiB |
#include "gap.h"
#include<bits/stdc++.h>
#define int long long
using namespace std;
long long findGap(int T, int n)
{
vector<int> a;
int x = -1, y = 2e18;
for(int i = 1; i <= (n+1)/2; i++){
MinMax(x+1, y-1, &x, &y);
a.push_back(x);
if(x != y) a.push_back(y);
}
sort(a.begin(), a.end());
int ans = 0;
for(int i = 1; i < a.size(); i++) ans = max(ans, a[i] - a[i-1]);
return ans;
}
