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

31960번 - Square of Triangles 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
5 초 (추가 시간 없음) 2048 MB (추가 메모리 없음)887100.000%

문제

You are given the squares of the lengths of the sides of four triangles. Determine if it is possible to arrange them (via translation, rotation, and reflection) into a square. No triangles may overlap, and there should be no gaps or holes.

Figure L.1: A solution to the third test case in the sample input.

입력

The first line of input contains a single integer $t$ (1ドル \leq t \leq 20$), which is the number of test cases.

Each of the next 4ドル \cdot t$ lines describes $t$ test cases, consisting of four triangles each, one triangle per line. Each triangle consists of three integers $a,ドル $b$ and $c$ (1ドル \leq a,b,c \leq 10^7$). Each of the integers is equal to the square of the length of a side of a triangle. For example, if the three sides of a triangle have lengths 3ドル,ドル 4ドル$ and 5ドル,ドル then the input would be 9 16 25. The integers will not necessarily be perfect squares. It is guaranteed that the given triples each represent a triangle of positive area.

출력

Output $t$ lines. For each test case in order, output a single line with a single integer, which is 1ドル$ if the four triangles of the test case can be arranged into a square, and 0ドル$ otherwise.

제한

예제 입력 1

3
1 1 2
2 1 1
2 1 1
1 2 1
1 1 1
1 1 1
1 1 1
1 1 1
5 125 130
125 20 145
45 130 145
145 145 80

예제 출력 1

1
0
1

힌트

출처

ICPC > Regionals > North America > North America Championship > North America Championship 2024 L번

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

출처

대학교 대회

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

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