제출 #1227584

#제출 시각아이디문제언어결과실행 시간메모리
1227584cpdreamerGap (APIO16_gap)C++20
0 / 100
40 ms1180 KiB
#include "gap.h" #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> using namespace __gnu_pbds; using namespace std; const long long INF = 1e17; typedef long long ll; const ll MOD = 1e9+7; #define F first #define pb push_back #define S second #define P pair #define V vector #define all(v) v.begin(), v.end() long long findGap(int T, int N) { ll l,r; MinMax (0,1e18,&l,&r ); ll lb=l; ll curr=l; ll ans=0; ll n=(ll)N; ll bnd=(r-l)/(n-1); while (curr<r) { ll mn,mx; MinMax(curr,curr +bnd-1,&mn,&mx); if (curr==lb) { if (mn!=mx) { lb=mx; curr+=bnd; } else curr+=bnd; } else { if (mn==-1) { curr+=bnd; } else { ans=max(ans,mn-lb); lb=mx; curr+=bnd; } } } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...