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

16522번 - Building a Field 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 512 MB2711239647.761%

문제

John is a meticulous person. In his farm he built a circular field with some trees planted right at the circumference of the field. Figure (a) below shows the field with the trees.

Now John wants to use a long rope and four of the field trees to demarcate a rectangle using the trees as vertices and the rope as edges. Figure (b) below shows two rectangles that can be demarcated using the trees of the field in figure (a).

Given the description of the positions of the trees in John’s circular field, you must determine whether it is possible to demarcate a rectangle using four of the trees as vertices and the rope as edges.

입력

The first line contains an integer N (4 ≤ N ≤ 105) indicating the number of trees in the field. Trees are represented as points on a circumference. The second line contains N integers L1, L2, . . . , LN (1 ≤ Li ≤ 106 for i = 1, 2, . . . , N) indicating the arc lengths between each pair of consecutive trees. The arcs are given in counter-clockwise order. The total length of the circumference does not exceed 109.

출력

Output a single line with the uppercase letter “Y” if it is possible to demarcate a rectangle using the given trees, and the uppercase letter “N” otherwise.

제한

예제 입력 1

8
3 3 4 2 6 2 2 2

예제 출력 1

Y

예제 입력 2

4
14 16 15 15

예제 출력 2

N

예제 입력 3

6
3 7 7 3 10 10

예제 출력 3

Y

힌트

출처

ICPC > Regionals > Latin America > Latin America Regional Contests > Latin America Regional Contests 2018 B번

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

출처

대학교 대회

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

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