답안 #217115

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
217115 2020-03-29T02:49:20 Z maruii 건물 4 (JOI20_building4) C++14
0 / 100
5 ms 512 KB
#include <bits/stdc++.h>
using namespace std;
int N, A[500001], B[500001];
int main() {
	ios_base::sync_with_stdio(0), cin.tie(0);
	cin >> N;
	for (int i = 1; i <= N * 2; ++i) cin >> A[i];
	for (int i = 1; i <= N * 2; ++i) cin >> B[i];
	int p = -1;
	string ans;
	for (int i = 1; i <= N * 2; ++i) {
		int a = A[i], b = B[i];
		if (a > b) swap(a, b);
		if (p > b) return !printf("-1");
		if (p <= a) p = a;
		else p = b;
		if (p == A[i]) ans.push_back('A');
		else ans.push_back('B');
	}
	cout << ans;
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 5 ms 512 KB Output is correct
3 Incorrect 4 ms 384 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 5 ms 512 KB Output is correct
3 Incorrect 4 ms 384 KB Output isn't correct
4 Halted 0 ms 0 KB -