제출 #304797

#제출 시각아이디문제언어결과실행 시간메모리
304797rocks03Gap (APIO16_gap)C++14
0 / 100
3076 ms2168 KiB
#include<bits/stdc++.h> #define ll long long #define SZ(x) ((int) (x).size()) using namespace std; void MinMax(long long s, long long t, long long *mn, long long *mx); long long findGap(int T, int N){ ll arr[N]; set<ll> s; for(int i = 0; i < N; i++){ ll l = 0, r = 1e18, mn, mx; if(i > 0) l = arr[i-1] + 1; if(SZ(s)) r = *s.begin(); while(r - l > 1){ ll m = (l + r) / 2; MinMax(l, m, &mn, &mx); if(mn == -1){ l = m; } else{ s.insert(mn); s.insert(mx); r = mx; } } arr[i] = *s.begin(); s.erase(s.find(arr[i])); } ll ans = 0; for(int i = 1; i < N; i++){ ans = max(ans, arr[i] - arr[i-1]); } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...