아직 만들고 있는 페이지입니다.

이 페이지는 아직 만드는 중입니다. 보이는 내용은 바뀔 수 있습니다.

Four Square

면접 대비

시간 제한4초메모리 제한2048 MB

요약
회전할 수 있는 직사각형 네 개가 빈틈이나 겹침 없이 정사각형을 이루도록 배치할 수 있는지 판정한다.
난이도

보통10점 중 5점

유형
기하, 완전 탐색, 구현, 수학
정답자
아직 제출이 없습니다

문제

Inspired by a Piet Mondrian painting, you want to make a four-pane window out of four colored rectangles of glass. You are given the sizes of the four panes of glass. Can you arrange them into a square? You may rotate the panes. The panes should cover the entire square without overlap.

입력

The input consists of exactly four lines. Each of the four lines contains two integers ww and hh (1≤w,h≤1,0001 \le w,h \le 1\\,000), representing the width and height of one of the four rectangular panes of glass.

출력

Output a single integer, which is 11 if the four panes can be arranged to form a square, and 00 otherwise.

예제2

  1. 예제 1

    입력
    1 1
    1 1
    1 1
    1 1
    
    예상 출력
    1
    
  2. 예제 2

    입력
    3 1
    3 3
    2 2
    3 3
    
    예상 출력
    0