Wrong Answer
Code
#include<bits/stdc++.h>
#define ll long long
#define int long long
using namespace std;
void solve()
{
int n; cin>> n;
vector<int> a(n),b(n);
for(int i=0;i<n;i++) cin>>a[i];
for(int i=0;i<n;i++) cin>>b[i];
sort(a.begin(),a.end());
sort(b.begin(),b.end());
int a1=n-2;
if(a1<1)
{
cout<<"Yes"<<endl;
}
else{
a1+=2;
if(a[2]>b[a1-1] || b[2]>a[a1-1])
{
cout<<"Yes"<<endl;
}
else cout<<"No"<<endl;
}
}
main()
{
ios::sync_with_stdio(false);
cin.tie(NULL);
ll t=1;cin>>t;
while(t--)
{
solve();
}
return 0;
}
Information
- Submit By
- Type
- Submission
- Problem
- P1193 C. Roy and Peak Array
- Contest
- Brain Booster #10
- Language
- C++17 (G++ 13.2.0)
- Submit At
- 2025-06-13 16:02:22
- Judged At
- 2025-06-13 16:02:22
- Judged By
- Score
- 0
- Total Time
- 34ms
- Peak Memory
- 540.0 KiB