제출 #1155003

#제출 시각아이디문제언어결과실행 시간메모리
1155003browntoadGap (APIO16_gap)C++20
87.64 / 100
43 ms3260 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long // #define int ll #define FOR(i, a, b) for (int i = (a); i < (b); i++) #define REP(i, n) FOR(i, 0, n) #define RREP(i, n) for (int i = (n)-1; i >= 0; i--) #define RREP1(i, n) for (int i = (n); i >= 1; i--) #define REP1(i, n) FOR(i, 1, n+1) #define pii pair<int, int> #define ppi pair<pii, int> #define pip pair<int, pii> // #define f first // #define s second #define pb push_back #define ALL(x) (x).begin(), (x).end() #define SZ(x) (int)((x).size()) #define endl '\n' #define IOS() ios::sync_with_stdio(false), cin.tie(0), cout.tie(0) // #include "grader.cpp" // remove this later #include "gap.h" ll findGap(int T, int N){ vector<ll> pts; if (T == 1){ ll L = 0, R = 1e18; REP(i, (N+1)/2){ ll pL = L, pR = R; MinMax(pL, pR, &L, &R); pts.pb(L); pts.pb(R); L++; R--; } sort(ALL(pts)); } else{ ll L, R; MinMax(0, 1e18, &L, &R); ll dif = R-L; pts.pb(L); ll gapsize = dif/(N-1) + (dif%(N-1)>0) - 1; for (ll i = L+1; i <= R-1; i += gapsize){ ll rptr = min(R-1, i+gapsize), lptr = i; ll tl, tr; MinMax(lptr, rptr, &tl, &tr); if (tl != -1){ pts.pb(tl); pts.pb(tr); } } pts.pb(R); } ll ans = 0; REP(i, SZ(pts)-1){ ans = max(ans, pts[i+1]-pts[i]); } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...