Submission #976419

#TimeUsernameProblemLanguageResultExecution timeMemory
976419biankGap (APIO16_gap)C++14
30 / 100
34 ms3832 KiB
#include <bits/stdc++.h> #include "gap.h" using namespace std; using ll = long long; #define all(x) begin(x), end(x) const ll MAX_A = 1e18; ll findGap(int T, int N) { ll mini = -1, maxi = MAX_A + 1; int q = (N + 1) / 2; vector<ll> a(N); int i = 0, j = N - 1; while (i <= j) { MinMax(mini + 1, maxi - 1, &mini, &maxi); assert(mini != -1), assert(maxi != -1); a[i++] = mini, a[j--] = maxi; } ll maxGap = 0LL; for (int i = 1; i < N; i++) { maxGap = max(maxGap, a[i] - a[i - 1]); } return maxGap; }

Compilation message (stderr)

gap.cpp: In function 'll findGap(int, int)':
gap.cpp:14:9: warning: unused variable 'q' [-Wunused-variable]
   14 |     int q = (N + 1) / 2;
      |         ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...