Submission #931138

# Submission time Handle Problem Language Result Execution time Memory
931138 2024-02-21T10:00:39 Z Amirreza_Fakhri Gap (APIO16_gap) C++17
Compilation error
0 ms 0 KB
// In the name of the God

#include "gap.h"

#include <bits/stdc++.h>
#define ll long long
// #define int long long
#define pb push_back
#define F first
#define S second
#define mp make_pair
#define pii pair <int, int>
#define smin(x, y) (x) = min((x), (y))
#define smax(x, y) (x) = max((x), (y))
#define all(x) (x).begin(), (x).end()
using namespace std;

const int inf = 1e9+7;
const int mod = 998244353;
const ll maxn = 1e18;

ll a[100005];

ll findGap(int t, int n) {
    if (t == 1) {
        j = 0;
        ll l = 1, r = MAXN;
        ll mn, mx;
        vector<ll> v;
        for (ll i = 0; i < (n + 1) / 2; i++) {
            MinMax(l, r, &mn, &mx);
            a[j++] = mn;
            a[j++] = mx;
            l = mn + 1, r = mx - 1;
        }
        sort(a, a + n);
        ll ans = 0;
        for (ll i = 0; i < n - 1; i++) ans = max(ans, a[i + 1] - a[i]);
        return ans;
    }
    return 1ll;
}

// int32_t main() {
//     ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
//     return 0;
// }











Compilation message

gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:26:9: error: 'j' was not declared in this scope
   26 |         j = 0;
      |         ^
gap.cpp:27:23: error: 'MAXN' was not declared in this scope
   27 |         ll l = 1, r = MAXN;
      |                       ^~~~