Submission #1145902

#TimeUsernameProblemLanguageResultExecution timeMemory
1145902Muaath_5Gap (APIO16_gap)C++20
0 / 100
45 ms3260 KiB
#ifndef MUAATH_5 #include "gap.h" #endif #include <bits/stdc++.h> #define ll long long using namespace std; long long findGap(int T, int N) { const ll n = N; ll mn, mx; MinMax(0, 1e18, &mn, &mx); const ll blk = (mx-mn)/n; vector<pair<ll, ll>> v; ll sol = blk; for (ll i = 1; mn+i*blk-1 <= mx; i++) { ll lmn=-1, lmx=-1; ll L = mn+(i-1)*(blk), R = mn+i*blk-1; MinMax(L, R, &lmn, &lmx); // cerr << i << ' ' << L << ' ' << R << ' ' << lmn << ' ' << lmx << endl; if (lmn != -1) { if (v.size()) sol = max(sol, lmn - v.back().second); v.push_back({lmn, lmx}); } } return sol; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...