제출 #1323354

#제출 시각아이디문제언어결과실행 시간메모리
1323354gustavo_dGap (APIO16_gap)C++20
70 / 100
61 ms7468 KiB
#include "gap.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; /* void MinMax(long long, long long, long long*, long long*); */ long long findGap(int T, int N) { // if (T == 1) { // ll ans = 0; // while (N > 0) { // N -= ; // } // return ans; // } ll L=0, R=0; MinMax(0LL, (ll)1e18, &L, &R); ll sz = (R-L+N-2) / (N - 1); ll l = L, r = L + sz; ll ans = sz; ll last = L; set<pair<ll, ll>> s; for (int i=0; i<N-1; i++, l = min(R, l+sz+1), r = min(R, r + sz+1)) { if (s.count({l, r})) continue; s.insert({l, r}); // cout << l << ' ' << r << '\n'; ll a=0, b=0; MinMax(l, r, &a, &b); if (a == -1) continue; ans = max(ans, a - last); last = b; if (r == R) break; } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...