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

32803번 - Ruffians 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 2048 MB78675590.164%

문제

Ashley and Brandon are playing the new hit card game, Ruffians!

In Ruffians, ten cards are dealt out in a grid of two rows and five columns. Each card has a number on it from 1 to 9. Ashley and Brandon are both looking for a pair of cards that have the same number.

After playing this game for a while, they realize that there is always a pair of cards that have the same number. To make the game harder, they require that they find a pair of cards with the same number, and that the two cards are in different rows and different columns.

Given an arrangement of cards, determine if such a pair exists or not.

입력

The first line of input contains a single integer $t$ (1ドル\leq t \leq 10^3$). This is the number of test cases.

Each test case is represented on two lines.

The first line of each test case contains five integers, each between 1ドル$ and 9ドル$. The second line of the test case also contains five integers, each between 1ドル$ and 9ドル$. These two lines combined form the grid of two rows and five columns of cards.

출력

Output $t$ lines, one for each test case.

For each test case, if there exists a pair of cards with the same number in different rows and different columns, output YES. Otherwise, output NO.

제한

예제 입력 1

3
1 2 3 4 5
1 2 3 4 5
1 2 3 4 5
2 6 7 8 9
5 5 5 5 5
5 5 5 5 5

예제 출력 1

NO
YES
YES

힌트

출처

ICPC > Regionals > North America > Pacific Northwest Regional > 2024 ICPC Pacific Northwest Regional > Division 2 F번

  • 문제를 만든 사람: Nick Wu
(追記) (追記ここまで)

출처

대학교 대회

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

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