Submission #591359

#TimeUsernameProblemLanguageResultExecution timeMemory
591359MohamedFaresNebiliGap (APIO16_gap)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> /// #pragma GCC optimize ("Ofast") /// #pragma GCC target ("avx2") /// #pragma GCC optimize("unroll-loops") using namespace std; using ll = long long; using ld = long double; #define ff first #define ss second #define pb push_back #define all(x) (x).begin(), (x).end() #define lb lower_bound ll findGap(int T, int N) { if(T == 1) { vector<ll> A(N + 2); A[0] = -1ll, A[N + 1] = 1000000000ll * 1000000000ll + 1ll; for(ll l = 1; l <= (N + 1) / 2; l++) { MinMax(A[l - 1] + 1, A[N - l + 2] - 1, &A[l], &A[N - l + 1]); } ll res = 0; for(ll l = 2; l <= N; l++) res = max(res, A[l] - A[l - 1]); return res; } vector<ll> S; ll mn, mx, res = 0; MinMax(0ll, 1000000000000000000ll, &mn, &mx); ll L = mn, R = mx; ll md = (R - l + N) / N; S.push_back(L); while(L < R) { MinMax(L + 1, min(B - 1, L + md), &mn, &mx); if(mx == -1 || mx == -1) continue; S.push_back(mn); S.push_back(mx); L += md; } S.push_back(R); for(int l = 1; l < S.size(); l++) res = max(res, S[l] - S[l - 1]); return res; }

Compilation message (stderr)

gap.cpp: In function 'll findGap(int, int)':
gap.cpp:22:25: error: 'MinMax' was not declared in this scope
   22 |                         MinMax(A[l - 1] + 1, A[N - l + 2] - 1, &A[l], &A[N - l + 1]);
      |                         ^~~~~~
gap.cpp:30:17: error: 'MinMax' was not declared in this scope
   30 |                 MinMax(0ll, 1000000000000000000ll, &mn, &mx);
      |                 ^~~~~~
gap.cpp:31:49: error: 'l' was not declared in this scope
   31 |                 ll L = mn, R = mx; ll md = (R - l + N) / N;
      |                                                 ^
gap.cpp:34:39: error: 'B' was not declared in this scope
   34 |                     MinMax(L + 1, min(B - 1, L + md), &mn, &mx);
      |                                       ^
gap.cpp:39:34: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   39 |                 for(int l = 1; l < S.size(); l++)
      |                                ~~^~~~~~~~~~