Submission #569557

# Submission time Handle Problem Language Result Execution time Memory
569557 2022-05-27T13:49:57 Z ali22413836 Gap (APIO16_gap) C++14
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
#define  endl "\n"
using namespace std ;
typedef long long ll;
typedef long double ld ;
const int N=2e7;
const ll inf=1e18 ;
const ll mod = 1e9 + 7 ;
ll mypower(ll x, ll y){
    if(y == 0) return 1 ;
    if(y == 1) return x ;
    ll ret = mypower(x , y / 2);
    ret = (ret * ret) % mod;
    if(y % 2) ret = ( ret * x ) % mod ;
    return ret ;
}
map < ll , ll > mp ;
vector < ll > v  ;
ll findGap(ll T, ll N){
    ll mn , mx ;
    if(T == 1){
        ll l = -1 , r = 1e18 + 1 ;
        while(r - l > 1){
            MinMax(l , r , &mn , &mx)
            if(mn == -1 && mx == -1){
                break ;
            }
            if(mp.count(mn) == 0){
                mp[mn] = 1 ;
                v.push_back(mn) ;
                l = mn ;
            }
            if(mp.count(mx) == 0){
                mp[mx] = 1 ;
                v.push_back(mx) ;
                r = mx ;
            }
        }
        sort(v.begin() , v.end()) ;
        ll ans = 0 ;
        for(int i = 1 ; i < N ; i++){
            ans = min(ans , v[i] - v[i - 1]) ;
        }
        cout << ans << endl ;
    }
    else
        return 1 ;
}
	

Compilation message

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