Wrong Answer
Code
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define all(x) (x).begin(), (x).end()
#define f(i, n) for (int i = 0; i < n; i++)
#define trace(x) cerr << #x << ": " << x << '\n'
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int t;
cin >> t;
while (t--)
{
int n;
cin >> n;
vector<int> a(n), b(n);
for (auto &x : a)
cin >> x;
for (auto &x : b)
cin >> x;
if (n < 3)
{
cout << "Yes\n";
continue;
}
sort(all(a));
sort(all(b));
reverse(all(a));
reverse(all(b));
int f = 1;
for (int i = 0; i < n - 2; i++)
{
if (a[i] > b[i])
{
}
else
f = 0;
}
if (f)
{
cout << "Yes\n";
continue;
}
f = 1;
for (int i = 0; i < n - 2; i++)
{
if (b[i] > a[i])
{
}
else
f = 0;
}
if (f)
{
cout << "Yes\n";
continue;
}
cout<< "No\n";
}
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 17:32:25
- Judged At
- 2025-06-13 17:32:25
- Judged By
- Score
- 5
- Total Time
- 22ms
- Peak Memory
- 540.0 KiB