Submission #1207010

#TimeUsernameProblemLanguageResultExecution timeMemory
1207010jasonicGap (APIO16_gap)C++20
30 / 100
29 ms3104 KiB
#include "gap.h" #include <bits/stdc++.h> using namespace std; #define ll long long #define fastIO cin.tie(0); ios::sync_with_stdio(false) ll findGap(int T, int N) { ll mn = 0, mx = 1e18; queue<ll> left; stack<ll> right; while(true) { ll l, r; MinMax(mn, mx, &l, &r); if(l == r) { left.push(l); } else { left.push(l); right.push(r); } mn = l + 1; mx = r - 1; if(left.size() + right.size() == N) break; } vector<ll> a; while(!left.empty()) { a.push_back(left.front()); left.pop(); } while(!right.empty()) { a.push_back(right.top()); right.pop(); } ll ans = 0; for(int i = 1; i < N; i++) { ans = max(ans, a[i] - a[i-1]); } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...