/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 764.0 KiB
#2 Accepted 1ms 532.0 KiB
#3 Wrong Answer 55ms 532.0 KiB
#4 Wrong Answer 55ms 548.0 KiB

Code

#include "bits/stdc++.h"
using namespace std;
#define k(n) begin(n), end(n)

void solve(){
  int n; cin >> n;
  vector<int> a(n), b(n);
  for (auto &e: a) cin >> e;
  for (auto &e: b) cin >> e;
  sort(k(a)), sort(k(b));
  
  int g1 = 1, g2 = 1;
  for (int i = 0; i < n - 2; i++){
    if (a[i+2] <= b[i] || a[i+2] <= b[i+2]) g1 = 0;
    if (b[i+2] <= a[i] || b[i+2] <= a[i+2]) g2 = 0;
  }
  cout << (g1 || g2 ? "Yes\n" : "No\n");
}

int main(){int t; cin >> t; while (t--) solve();}

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:50:31
Judged At
2025-06-13 16:50:31
Judged By
Score
5
Total Time
55ms
Peak Memory
764.0 KiB