《补题》(牛客小白月赛66:空洞骑士)

125 阅读1分钟

思维

#include <bits/stdc++.h>

using i64 = long long;

int main() {
	std::ios::sync_with_stdio(false);
	std::cin.tie(nullptr);

	int n, max = 0, min = 1e9;
	std::cin >> n;

	std::vector<int> a(n);
	for (int i = 0; i < n; i ++) {
		std::cin >> a[i];
		if (max < a[i]) {
			max = a[i];
		}
		if (min > a[i]) {
			min = a[i];
		}
	}

	int ans = std::max(std::max(max * 2 - 1, ((int)(1e9) - min) * 2 - 1), (int)(1e9));
	if (ans == max * 2 - 1) {
		std::cout << 0 << " " << 1 << "\n";	
	} else if (ans == ((int)(1e9) - min) * 2 - 1) {
		std::cout << (int)(1e9) << " " << (int)(1e9) - 1 << "\n";
	} else {
		std::cout << 0 << " " << (int)(1e9) << "\n";
	}

	return 0;
}