Submission #1027497

# Submission time Handle Problem Language Result Execution time Memory
1027497 2024-07-19T07:06:11 Z KasymK Gap (APIO16_gap) C++17
Compilation error
0 ms 0 KB
#include "bits/stdc++.h"
using namespace std;
#define pb push_back
#define all(v) v.begin(), v.end()
#define ll long long

ll findGap(int t, int n){
    if(t == 1){
        ll l = 1, r = 1e18, id = 0, mn, mx;
        vector<ll> a;
        a.resize(n+5);
        for(int i = 0; i < (n+1)>>1; ++i){
            MinMax(l, r, &mn, &mx);
            a[id++] = mn;
            a[id++] = mx;
            l = mn+1, r = mx-1;
        }
        sort(all(a));
        ll answer = 0;
        for(int i = 0; i < n-1; ++i)
            answer = max(answer, a[i+1]-a[i]);
        return answer;
    }
}

Compilation message

gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:13:13: error: 'MinMax' was not declared in this scope
   13 |             MinMax(l, r, &mn, &mx);
      |             ^~~~~~
gap.cpp:24:1: warning: control reaches end of non-void function [-Wreturn-type]
   24 | }
      | ^