Submission #217115

#TimeUsernameProblemLanguageResultExecution timeMemory
217115maruiiBuilding 4 (JOI20_building4)C++14
0 / 100
5 ms512 KiB
#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; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...