Submission #800247

#TimeUsernameProblemLanguageResultExecution timeMemory
800247pavementGap (APIO16_gap)C++17
0 / 100
36 ms3052 KiB
#include "gap.h" #include <bits/stdc++.h> using namespace std; #define pb push_back using ll = long long; ll findGap(int T, int N) { ll x, y, l = 0, r = (ll)1e18, ans = 0; vector<ll> lh, rh, all; while (l <= r) { MinMax(l, r, &x, &y); if (x == -1) break; lh.pb(x); rh.pb(y); l = x + 1; r = y - 1; } reverse(rh.begin(), rh.end()); for (auto i : lh) all.pb(i); for (auto i : rh) all.pb(i); for (int i = 1; i < (int)all.size(); i++) { ans = max(ans, all[i] - all[i - 1]); } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...