Submission #655009

#TimeUsernameProblemLanguageResultExecution timeMemory
655009ssenseGap (APIO16_gap)C++14
0 / 100
41 ms1876 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) { 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) { if(ask1 > ask2) { break; } 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; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...