This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#define endl "\n"
#define finp for(int i=0; i<n; i++)
#define fknp for(int k=0; k<n; k++)
#define yeap cout<<"YES"<<endl
#define nope cout<<"NO"<<endl
#define inpintn int n; cin>>n
#define inpintarrn int arr[n]; for(int i=0; i<n; i++){cin>>arr[i];}
#define inpllarrn long long arr[n]; for(int i=0; i<n; i++){cin>>arr[i];}
#define ll long long
#define pb push_back
#define answer cout<<ans<<endl
#define INF (ll)(1e18)
using namespace std;
int main ()
{
ll n;
cin>>n;
ll arr[2*n];
ll brr[2*n];
for(int i=0; i<2*n; i++){
cin>>arr[i];
}
for(int i=0; i<2*n; i++){
cin>>brr[i];
}
ll aa = 2*n;
sort(arr, arr+aa);
sort(brr, brr+aa);
ll a = 0;
ll b = 0;
for(int i=0; i<2*n; i++){
if(a>=n){
cout<<"B";
b++;
// cout<<brr[b]<<endl;
} else if(b>=n){
cout<<"A";
a++;
// cout<<arr[a]<<endl;
} else {
if(arr[a]<brr[b]){
cout<<"A";
a++;
// cout<<arr[a]<<endl;
} else {
cout<<"B";
b++;
// cout<<brr[b]<<endl;
}
}
}
// cout<<endl;
// for(int i=0; i<2*n; i++){
// cout << arr[i] << " ";
// }
// cout<<endl;
// for(int i=0; i<2*n; i++){
// cout << brr[i] << " ";
// }
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |