Submission #1232339

#TimeUsernameProblemLanguageResultExecution timeMemory
1232339marselelGap (APIO16_gap)C++20
0 / 100
45 ms7040 KiB
#include "gap.h" #include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; # define all(a) a.begin(), a.end() # define rall(a) a.rbegin(), a.rend() # define pii pair<int, int> # define pll pair<ll, ll> #ifdef LOCAL #include "algo/debug.h" #else # define debug(x) #endif constexpr int inf = 0x3f3f3f3f; constexpr ll INF = 2e15; const ld RANDMAX = (1LL << 32) - 1; const ll mod = 1'000'000'007; ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// int findGap(int T, int N) { set<ll> st; ll s = -1, t = 2e18; ll mn = 0, mx = 0; while (s <= t) { MinMax(s, t, &mn, &mx); if (mn == -1 && mx == -1) { break; } st.insert(mn); st.insert(mx); s = mn + 1; t = mx - 1; } vector<ll> a; for (auto v : st) { a.push_back(v); } ll ans = 0; for (int i = 1; i < (int)a.size(); ++i) { ans = max(ans, a[i] - a[i - 1]); } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...