【C++】已通过

#include<string>
#define MAX 1000000
//int a[MAX];
using namespace std;
int main() {
	int N;
	while (cin >> N) {
		int min = MAX; int max = -MAX;
		for (int i = 0; i < N; i++) {
			int temp; cin >> temp;
			if (min > temp)min = temp;
			if (max < temp)max = temp;
		}
		cout << max << " " << min << endl;
	}

	return 0;
}