제출 #262373

#제출 시각아이디문제언어결과실행 시간메모리
262373my99nGap (APIO16_gap)C++14
0 / 100
94 ms10784 KiB
#include "gap.h" #include <bits/stdc++.h> using namespace std; vector<long long> a; void findarr (long long low, long long high) { long long mnl, mxl, mnr, mxr; int mid = (low+high)/2; MinMax(low, low, &mnl, &mxl); MinMax(mid+1, high, &mnr, &mxr); if (mnl != -1) { a.push_back(mnl); a.push_back(mxl); } if (mnr != -1) { a.push_back(mnr); a.push_back(mxr); } if (mnl != mxl) findarr(mnl+1, mxl-1); if (mnr != mxr) findarr(mnr+1, mxr-1); } long long findGap(int T, int N) { if (T == 1) { long long mn, mx; long long l = 0, r = 1e18; while (true) { MinMax(l, r, &mn, &mx); if (mn != -1) {; a.push_back(mn); a.push_back(mx); } if (mn == mx) break; l = mn+1; r = mx-1; } } else { findarr(0, 1e18); } long long ans = 0; sort(a.begin(), a.end()); 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...