Submission #1027395

#TimeUsernameProblemLanguageResultExecution timeMemory
1027395MuhammetGap (APIO16_gap)C++17
0 / 100
32 ms4412 KiB
#include <bits/stdc++.h> #include "gap.h" using namespace std; #define ll long long #define sz(s) (int)s.size() const ll M = 1e9 + 7; ll findGap(int T, int n){ vector <ll> v, v1; for(int i = 0; i < (n+1)/2; i++){ ll s, t, mn, mx; if(i == 0) s = 0, t = 1e18; else s = v.back()+1, t = v1.back()-1; if(s > t) break; MinMax(s, t, &mn, &mx); v.push_back(mn); v1.push_back(mx); } if(n % 2 == 1) v1.pop_back(); while(sz(v1) > 0){ v.push_back(v1.back()); v1.pop_back(); } ll ans = 0; for(int i = 0; i < n-1; i++){ ll x = (v[i+1] - v[i]); ans = max(ans, x); } return ans%M; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...