Submission #1113895

#TimeUsernameProblemLanguageResultExecution timeMemory
1113895Dan4LifeBuilding 4 (JOI20_building4)C++17
0 / 100
1 ms2384 KiB
#include <bits/stdc++.h> using namespace std; #define pb push_back #define sz(a) (int)a.size() #define all(a) begin(a),end(a) #define int long long const int N = (int)1e6+10; int n, a[2][N]; int32_t main(){ ios_base::sync_with_stdio(false); cin.tie(0); cin >> n; for(int i = 0; i < 2*n; i++) cin >> a[0][i]; for(int i = 0; i < 2*n; i++) cin >> a[1][i]; for(int i = 0; i <= n; i++){ bool ok = 1; int prv = -1; for(int j = 0; j < 2*n; j++){ if(j>=i and j<i+n) continue; ok&=a[0][j]>=prv, prv=a[0][j]; } prv=-1; for(int j = i; j < i+n; j++) ok&=a[1][j]>=prv, prv=a[1][j]; if(ok){ for(int j = 0; j < 2*n; j++) cout << "AB"[j>=i and j<i+n]; cout << "\n"; return 0; } } cout << -1 << "\n"; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...