Submission #1027718

# Submission time Handle Problem Language Result Execution time Memory
1027718 2024-07-19T09:26:34 Z Gangsta Gap (APIO16_gap) C++14
Compilation error
0 ms 0 KB
#include "bits/stdc++.h"
#include "gap.h"
#define ll long long
#define pb push_back
#define pii pair<ll,ll>
#define ff first
#define ss second
#define sz size()

const int N = 2e5 + 1;

using namespace std;

ll ans;

// void MinMax(ll s, ll t, ll &mn, ll &mx){
// 	int a, b;
// 	cin >> a >> b;
// 	mn = a;
// 	mx = b;
// }

ll findGap(int t, int n){
	ll mn, mx, l = -1, r = 1e18;
	r++;
	if(t == 1){
		while(1){
			if(l + 1 > r - 1) return ans;
			MinMax(l + 1, r - 1, mn, mx);
			if(mn == -1){
				ans = max(ans,r-l);
				return ans;
			}
			l = mn;
			r = mx;
			ans = max({ans,mn-l,r-mx});
		}
	}
}

// int main(){
//     int n, t;
//     cin >> t >> n;
//     cout << findGap(t, n);
// }

Compilation message

gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:29:25: error: invalid conversion from 'long long int' to 'long long int*' [-fpermissive]
   29 |    MinMax(l + 1, r - 1, mn, mx);
      |                         ^~
      |                         |
      |                         long long int
In file included from gap.cpp:2:
gap.h:1:35: note:   initializing argument 3 of 'void MinMax(long long int, long long int, long long int*, long long int*)'
    1 | void MinMax(long long, long long, long long*, long long*);
      |                                   ^~~~~~~~~~
gap.cpp:29:29: error: invalid conversion from 'long long int' to 'long long int*' [-fpermissive]
   29 |    MinMax(l + 1, r - 1, mn, mx);
      |                             ^~
      |                             |
      |                             long long int
In file included from gap.cpp:2:
gap.h:1:47: note:   initializing argument 4 of 'void MinMax(long long int, long long int, long long int*, long long int*)'
    1 | void MinMax(long long, long long, long long*, long long*);
      |                                               ^~~~~~~~~~
gap.cpp:39:1: warning: control reaches end of non-void function [-Wreturn-type]
   39 | }
      | ^