제출 #182420

#제출 시각아이디문제언어결과실행 시간메모리
182420AQTGap (APIO16_gap)C++14
30 / 100
74 ms2040 KiB
#include <bits/stdc++.h> #include "gap.h" using namespace std; long long arr[100005]; long long findGap(int T, int N){ if(T == 1){ int l = 1, r = N; long long lstl = -1, lstr = 1000000000000000001LL; while(l <= r){ MinMax(lstl+1, lstr-1, &lstl, &lstr); arr[l++] = lstl, arr[r--] = lstr; } long long ans = 0; for(int i = 2; i<=N; i++){ ans = max(ans, arr[i]-arr[i-1]); } return ans; } fill(arr+1, arr+1+N, -1); long long s, e; MinMax(0, 1000000000000000000LL, &s, &e); long long d = (e-s)/(N-1); arr[1] = s, arr[N] = e; long long lst = s; long long ans = 0; long long n = s; while(n < e){ long long t; MinMax(n, n+d, &s, &t); ans = max(ans, s-lst); lst = t; n += d; } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...