제출 #390931

#제출 시각아이디문제언어결과실행 시간메모리
390931BlagojceGap (APIO16_gap)C++11
53.51 / 100
72 ms1124 KiB
#include <bits/stdc++.h> #define fr(i, n, m) for(int i = (n); i < (m); i ++) #define pb push_back #define st first #define nd second #define pq priority_queue #define all(x) begin(x), end(x) using namespace std; typedef long long ll; typedef long double ld; typedef pair<int,int> pii; const int mxn = 1e5; #include "gap.h" long long findGap(int T, int N) { ll a1, an; MinMax(0, 1e18, &a1, &an); ll d = (an - a1)/(N-1); ll pr = a1; ll ans = 0; for(int i = 0; a1 + i*d <= an; i++){ ll ai, aj; MinMax(a1 + i*d, min(a1 + (i+1)*d-1, an), &ai, &aj); if(ai != -1){ ans = max(ans, ai-pr); pr = aj; } } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...