Submission #978184

# Submission time Handle Problem Language Result Execution time Memory
978184 2024-05-09T02:37:25 Z Amaarsaa Gap (APIO16_gap) C++14
Compilation error
0 ms 0 KB
#include<bits/stdc++.h>
#include "gap.h"
using namespace std;
using ll =long long;
ll Sub1(ll N) {
	ll b[N + 2],ans, lo1, hi1, lo, hi, l, r;
	l = 1;
	r = N;
	lo = 0;
	hi = LONG_MAX;
	while ( l <= r) {
		MinMax(lo, hi, &lo1, &hi1);
		if (lo1 == -1) break;
		b[l] = lo1;
		b[r] = hi1;
		lo = lo1 + 1;
		hi = hi1 - 1;
		l ++;
		r --;
	}
	ans = 0;
	for (int i = 2; i <= N; i ++) {
		ans =max(ans, b[i] - b[i - 1]);
	}
	return ans;
}
ll Sub2(ll N) {
	
	ll l, r, x, y, ans, n = N;
	MinMax(0, 1e18, &l, &r);
	s = (r - l - 1)/(n - 1);
	ans = s;
	for ( i = l; i <= r; i += (s + 1)) {
		MinMax(i, i + s, &x, &y);
		if ( x != -1) {
			ans =max(ans, x - l);
			l = y;
		}
	}
	
	return ans;
}
long long findGap(int T, int N) {
	if ( T == 1) {
		return Sub1(N); 
	}
	else return Sub1(N);
}

Compilation message

gap.cpp: In function 'll Sub2(ll)':
gap.cpp:31:2: error: 's' was not declared in this scope
   31 |  s = (r - l - 1)/(n - 1);
      |  ^
gap.cpp:33:8: error: 'i' was not declared in this scope
   33 |  for ( i = l; i <= r; i += (s + 1)) {
      |        ^