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

10855번 - Extreme Sort 다국어

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

문제

John likes sorting algorithms very much. He has studied quicksort, merge sort, radix sort, and many more.

A long time ago he has written a lock-free parallel string sorting program. It was a combination of burstsort and multi-key quicksort. To implement burstsort you need to build a tree of buckets. For each input string you walk through the tree and insert part of the string into the right bucket. When a bucket fills up, it "bursts" and becomes a new subtree (with new buckets).

Figure G.1: Burstsort data structure

Well, enough about the past. Today John is playing with sorting algorithms again. This time it’s numbers. He has an idea for a new algorithm, “extreme sort”. It’s extremely fast, performance levels are OVER NINETHOUSAND. Before he tells anyone any details, he wants to make sure that it works correctly.

Your task is to help him and verify that the so-called extreme property holds after the first phase of the algorithm. The extreme property is defined as min (xi,j) ≥ 0, where

xi,j = aj - ai (1 ≤ i < j ≤ N)
 = 9001 (otherwise)

입력

The first line contains a single integer N (1 ≤ N ≤ 1024). The second line contains N integers a1 a2 . . . aN (1 ≤ ai ≤ 1024).

출력

Print one line of output containing “yes” if the extreme property holds for the given input, “no” otherwise.

제한

예제 입력 1

2
1 2

예제 출력 1

yes

예제 입력 2

4
2 1 3 4

예제 출력 2

no

힌트

출처

ICPC > Regionals > Europe > Northwestern European Regional Contest > German Collegiate Programming Contest > GCPC 2015 G번

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

출처

대학교 대회

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

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