Submission #554434

#TimeUsernameProblemLanguageResultExecution timeMemory
554434fatemetmhrGap (APIO16_gap)C++17
30 / 100
47 ms2328 KiB
// Be name khoda // #include "gap.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; #define all(x) x.begin(), x.end() #define fi first #define se second #define pb push_back const int maxn5 = 5e2 + 5; const int maxnb = 1e3 + 10; const int mod = 1e9 + 7; vector <ll> have; long long findGap(int T, int N) { ll lo = 0, hi = 1e18; int rem = N; while(rem > 0 && hi >= lo){ ll mn, mx; MinMax(lo, hi, &mn, &mx); //cout << "asking for " << lo << ' ' << hi << ' ' << mn << ' ' << mx << endl; have.pb(mn); if(mx != mn) have.pb(mx); lo = mn + 1; hi = mx - 1; rem -= 2; } sort(all(have)); ll ans = 0; for(int i = 1; i < N; i++) ans = max(ans, have[i] - have[i - 1]); return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...