제출 #655293

#제출 시각아이디문제언어결과실행 시간메모리
655293ssenseGap (APIO16_gap)C++14
0 / 100
62 ms1896 KiB
#include <bits/stdc++.h> #include "gap.h" #define startt ios_base::sync_with_stdio(false);cin.tie(0); typedef long long ll; using namespace std; #define vint vector<int> #define all(v) v.begin(), v.end() #define MOD 1000000007 #define MOD2 998244353 #define MX 1000000000 #define MXL 1000000000000000000 #define PI (ld)2*acos(0.0) #define pb push_back #define sc second #define fr first //#define int long long #define endl '\n' #define ld long double #define NO cout << "NO" << endl #define YES cout << "YES" << endl long long findGap(int T, int N) { if(T == 1) { long long mn, mx; long long ask1 = 0, ask2 = 1e18; vector<long long> a(N); for(int i = 0; i < N; i++) { a[i] = -1; } long long nowi = 0, nowi2 = N-1; while(true) { MinMax(ask1, ask2, &mn, &mx); if(mn == -1 && mx == -1) { break; } if(mn == mx) { a[nowi] = mn; break; } a[nowi] = mn; nowi++; a[nowi2] = mx; nowi2--; ask1 = mn+1; ask2 = mx-1; } long long ans = 0; for(int i = 0; i < N-1; i++) { assert(a[i] != -1); ans = max(ans, a[i+1]-a[i]); } return ans; } else { long long mn, mx; MinMax(0, 1e18, &mn, &mx); long long size = mx-mn-1; long long nowmin = mn+1, last = mn; long long ans = size/(N-1); for(int i = 0; i < N-1; i++) { long long nowmax = nowmin+size/(N-1)-1; MinMax(nowmin, nowmax, &mn, &mx); if(mn != -1) { ans = max(ans, mn-last); last = mx; } nowmin = nowmax+1; } return ans; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...