제출 #630225

#제출 시각아이디문제언어결과실행 시간메모리
630225Arnch건물 4 (JOI20_building4)C++17
0 / 100
1 ms340 KiB
// oooo /* har chi delet mikhad bebar ~ gitar o ba khodet nabar! ~ ;Amoo_Hasan; */ #include<bits/stdc++.h> //#pragma GCC optimize("O3,no-stack-protector,unroll-loops") //#pragma GCC target("avx2,fma") using namespace std; typedef long long ll; typedef long double ld; #define Sz(x) int((x).size()) #define All(x) (x).begin(), (x).end() #define wtf(x) cout<<#x <<" : " <<x <<endl #define mak make_pair //constexpr int PRI = 1000696969; constexpr ll INF = 1e18, N = 1e6 + 10, MOD = 1e9 + 7; int a[N], b[N]; int main() { ios :: sync_with_stdio(0), cin.tie(0); cout.tie(0); int n; cin >>n; for(int i = 0; i < 2 * n; i++) cin >>a[i]; for(int i = 0; i < 2 * n; i++) cin >>b[i]; for(int mask = 0; mask < (1 << (2 * n)); mask++) { if(__builtin_popcount(mask) != n) continue; vector<int> vc; for(int j = 0; j < 2 * n; j++) { if((mask >> j) & 1) vc.push_back(a[j]); else vc.push_back(b[j]); } bool ex = 0; for(int i = 1; i < Sz(vc); i++) { if(vc[i] < vc[i - 1]) { ex = 1; break; } } if(ex) continue; string s = ""; for(int j = 0; j < 2 * n; j++) { if((mask >> j) & 1) s.push_back('A'); else s.push_back('B'); } cout<<s; return 0; } cout<<-1; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...