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