Logo
(追記) (追記ここまで)

7822번 - Worst Locations 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 128 MB46111023.256%

문제

Two pandas A and B like each other. They have been placed in a bamboo jungle (which can be seen as a perfect binary tree graph of 2N-1 vertices and 2N-2 edges whose leaves are all of the same depth) at different locations. The jungle organizers (yes, such organizers exist), being a bit disorganized, only note down two integers X and Y as an indicator of the location of a panda which is translated as: that panda is now at a vertex whose distance is exactly Y vertices away from the leaf X. The leaves are numbered from 1 to 2N-1 from left to right. As you might have noticed, this indicator may correspond to more than one vertex. For example, the image below shows possible locations for N = 4, X = 3, Y = 3.

Back to our two pandas, the indicators of the locations of these two pandas are (XA, YA) and (XB, YB). One can shout to another such that if they are at most Z vertices away from each other, the other can hear that shout. The question is, given the height of the jungle layout, the location indicators of these two pandas and the strength of their shouts, is it possible that these two pandas cannot hear each other's shout?

입력

The first line of input contains an integer T (T ≤ 50,000) denoting the number of testcases. Each testcase is represented by a single line containing 6 space-separated integers N, XA, YA, XB, YB, and Z (1 ≤ N ≤ 31; 1 ≤ XA, XB ≤ 2N-1; 0 ≤ YA, YB, Z ≤ 2 * N - 2) denoting the height of the perfect binary tree jungle layout, the location indicators of the two pandas, and the strength of their shouts.

출력

For each testcase, write "YES" to a single line of output if it is the case that these two pandas might not be able to hear each other's shout, and "NO" otherwise.

제한

예제 입력 1

2
4 3 3 3 3 2
4 3 3 3 3 1

예제 출력 1

NO
YES

힌트

출처

ICPC > Regionals > Asia Pacific > Indonesia > Jakarta > ACM-ICPC Regional Jakarta 2010 A번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /