Cod sursa(job #2593013)

Utilizator segtreapMihnea Andreescu segtreap Data 2 aprilie 2020 18:19:53
Problema Aho-Corasick Scor 0
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.55 kb
#include <bits/stdc++.h>

using namespace std;

bool ok(int x, int l, int r, int a, int b) {
  if (a + b > 0 && l == x && x == r) {
    return 0;
  } else {
    return (l <= x - a + b && x - a + b <= r);
  }
}

int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);

  int t;
  cin >> t;
  while (t--) {
    int x, y, r1, c1, r2, c2, a, b, c, d;
    cin >> a >> b >> c >> d >> x >> y >> r1 >> c1 >> r2 >> c2;
    if (ok(x, r1, r2, a, b) && ok(y, c1, c2, c, d)) {
      cout << "Yes\n";
    } else {
      cout << "No\n";
    }
  }

}