/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 540.0 KiB
#2 Wrong Answer 1ms 540.0 KiB
#3 Wrong Answer 21ms 796.0 KiB

Code

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


#define int long long


void iusearchbtw () {
        int n; cin >> n;
        vector<int> a(n + 1), b(n + 1);
        for (int i = 1; i <= n; i++) cin >> a[i];
        for (int i = 1; i <= n; i++) cin >> b[i];
        sort(a.begin() + 1, a.end());
        sort(b.begin() + 1, b.end());
        bool ok = 1;
        for (int i = 2; i <= n - 1; i++) {
                ok &= ((a[i - 1] < b[i] && b[i] > a[i + 1]) || (b[i - 1] < a[i] && a[i] > b[i + 1]));
        }
        cout << (ok ? "Yes\n" : "No\n");
}






signed main () {
        ios_base::sync_with_stdio(0);
        cin.tie(0);
        cout.tie(0);
        int tt = 1;	
        cin >> tt;
	while (tt --> 0) iusearchbtw();
}

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:44:59
Judged At
2025-06-13 17:44:59
Judged By
Score
0
Total Time
21ms
Peak Memory
796.0 KiB