Submission #629913

#TimeUsernameProblemLanguageResultExecution timeMemory
629913hy_1Gap (APIO16_gap)C++14
Compilation error
0 ms0 KiB
#include "gap.h"
#include <bits/stdc++.h>


#define ll long long

using namespace std;


long long findGap(int T, int n){

	vector<ll> arr;
	ll  l  =0 , r = 1e18;
	while(arr.size() < n){
		ll mn , mx;
		MinMax(l , r , &mn , &mx);
		arr.push_back(mn);
		if(mn != mx){
			arr.push_back(mx);
		}
		l = mn + 1;
		r = mxn -1;
	}

	ll ans = 0;

	sort(arr.begin() , arr.end());
	
	for(int i =1; i<n; i++){
		ans = max(ans , arr[i] - arr[i-1]);
	}
	return ans;
}

Compilation message (stderr)

gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:14:19: warning: comparison of integer expressions of different signedness: 'std::vector<long long int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   14 |  while(arr.size() < n){
      |        ~~~~~~~~~~~^~~
gap.cpp:22:7: error: 'mxn' was not declared in this scope; did you mean 'mx'?
   22 |   r = mxn -1;
      |       ^~~
      |       mx