답안 #593327

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
593327 2022-07-10T21:46:17 Z YesPy Gap (APIO16_gap) C++17
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>

#define maxs(i, j) (i = max(i, j))
#define fastio ios::sync_with_stdio(false);cin.tie(nullptr);
#define ln '\n'
#define nwln cout<<ln;

using namespace std;

typedef long long ll;

const ll LINF = 1001001001001001001;
ll a[100001], pos, ans, mn, mx;

ll findGap(int T, int N) {
	if(T == 1) {
		ll l = 1, r = LINF;
		
		for(int i = 0; i<((N+1)>>1); ++i) {
			MinMax(l, r, &mn, &mx);
			a[pos++] = mn, a[pos++] = mx;
			l = mn + 1, r = mx - 1;
		}

		sort(a, a + N);
		for(ll i=1; i<N; ++i) maxs(ans, (a[i] - a[i-1]));

		return ans;
	} else {
		MinMax(1, LINF, &mn, &mx);
		ll block = (mx - mn + N - 2)/(N - 1), Mn, Mx, L;
		
		for(pos=mn, ++block; (pos+block)<=mx; pos += block) {
			MinMax(pos, pos+block-1, &Mn, &Mx);
			if(Mn != -1) maxs(ans, (Mn - L)), L = Mx;
		}

		MinMax(pos, mx, &Mn, &Mx);
		if(Mn != -1) maxs(ans, (Mn - L));
		
		return ans;
	}
}

Compilation message

gap.cpp: In function 'll findGap(int, int)':
gap.cpp:20:4: error: 'MinMax' was not declared in this scope
   20 |    MinMax(l, r, &mn, &mx);
      |    ^~~~~~
gap.cpp:30:3: error: 'MinMax' was not declared in this scope
   30 |   MinMax(1, LINF, &mn, &mx);
      |   ^~~~~~