/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Accepted 2ms 532.0 KiB
#2 Wrong Answer 2ms 532.0 KiB
#3 Wrong Answer 21ms 624.0 KiB

Code

#include <bits/stdc++.h>
using namespace std;

#ifdef LOCAL
#include "debug.h"
#else
#define dbg(...) 42
#endif

#define int long long

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());

    for (int i = 1; i < n - 1; i++) {
        if (a[i] > max(b[i - 1], b[i + 1]) || b[i] > max(a[i - 1], a[i + 1])) {

        }
        else {
            cout << "No" << '\n';
            return;
        }
    }

    cout << "Yes" << '\n';
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int t;
    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 15:36:14
Judged At
2025-06-13 15:36:14
Judged By
Score
0
Total Time
21ms
Peak Memory
624.0 KiB