제출 #304773

#제출 시각아이디문제언어결과실행 시간메모리
304773rocks03Gap (APIO16_gap)C++14
0 / 100
107 ms2040 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 l = 0, r = 1e18, mn, mx, arr[N]; multiset<ll> ms; for(int i = 0; i < N; i++){ while(r - l > 1){ ll m = (l + r) / 2; MinMax(l, m, &mn, &mx); if(mn == -1){ break; } else{ l = mn + 1; r = mx - 1; ms.insert(mn); ms.insert(mx); } } arr[i] = *ms.begin(); ms.erase(arr[i]); if(SZ(ms)){ l = arr[i] + 1; r = *ms.begin(); } else{ l = arr[i] + 1; r = 1e18; } } 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...