제출 #340900

#제출 시각아이디문제언어결과실행 시간메모리
340900super_j6Gap (APIO16_gap)C++14
89.04 / 100
73 ms1280 KiB
#include "gap.h" #include <iostream> #include <cstdio> #include <algorithm> using namespace std; #define endl '\n' #define ll long long void f(ll l, ll r, ll &x, ll &y){ MinMax(l, r, &x, &y); } ll findGap(int t, int n){ ll l, r, ret = 0; f(0, 1e18, l, r); if(t & 1){ for(ll i = 1, x, y; 2 * i < n && r - l > 1; i++, l = x, r = y){ f(l + 1, r - 1, x, y); if(!~x || !~y) break; ret = max({ret, r - y, x - l}); } }else{ for(ll d = (r - l) / (n - 1), i = l + 1; i < r; i += d){ ll x, y; f(i, min(r - 1, i + d - 1), x, y); if(~x && ~y) ret = max({ret, x - l, y - x}), l = y; } } ret = max(ret, r - l); return ret; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...