답안 #977849

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
977849 2024-05-08T11:52:02 Z Amaarsaa Gap (APIO16_gap) C++14
컴파일 오류
0 ms 0 KB
#include<bits/stdc++.h>
//#include "gap.h"
using namespace std;
using ll =long long;
ll a[1000005], n;
void MinMax(ll s, ll t, ll&mn, ll&mx) {
	mn = lower_bound(a + 1, a + n + 1, s) - a;
	if ( mn == n + 1) {
		mn = -1;
		mx = -1;
		return ;
	}
	mn = a[mn];
	mx = upper_bound(a + 1, a + n + 1, t) - a;
	mx --;
	mx = a[mx];
}
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) {
	return N;
}
long long findGap(int T, int N) {
	if ( T == 1) {
		return Sub1(N); 
	}
	else return Sub1(N);
}
ll inp() {
	cin >> n;
	for (int i = 1; i <= n; i ++) cin >> a[i];
}
int main() {
	inp();
	cout << findGap(1, n) << endl;
}

Compilation message

gap.cpp: In function 'll inp()':
gap.cpp:52:1: warning: no return statement in function returning non-void [-Wreturn-type]
   52 | }
      | ^
/usr/bin/ld: /tmp/cc43qBdE.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccXbLtlF.o:gap.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status