codeforces-scrape

Codeforces scraped problems and editorials
git clone git://git.laack.co/codeforces-scrape.git
Log | Files | Refs | README

108B.md (1616B)


      1 Source: https://codeforces.com/problemset/problem/108/B
      2 
      3 B. Datatypes
      4 
      5 time limit per test
      6 
      7 2 seconds
      8 
      9 memory limit per test
     10 
     11 256 megabytes
     12 
     13 input
     14 
     15 stdin
     16 
     17 output
     18 
     19 stdout
     20 
     21 Tattah's youngest brother, Tuftuf, is new to programming.
     22 
     23 Since his older brother is such a good programmer, his biggest dream is to outshine him. Tuftuf is a student at the German University in Cairo (GUC) where he learns to write programs in Gava.
     24 
     25 Today, Tuftuf was introduced to Gava's unsigned integer datatypes. Gava has *n* unsigned integer datatypes of sizes (in bits) *a*1, *a*2, ... *a**n*. The *i*-th datatype have size *a**i* bits, so it can represent every integer between 0 and 2*a**i* - 1 inclusive.
     26 
     27 Tuftuf is thinking of learning a better programming language. If there exists an integer *x*, such that *x* fits in some type *i* (in *a**i* bits) and *x*·*x* does not fit in some other type *j* (in *a**j* bits) where *a**i* < *a**j*, then Tuftuf will stop using Gava.
     28 
     29 Your task is to determine Tuftuf's destiny.
     30 
     31 Input
     32 
     33 The first line contains integer *n* (2 ≤ *n* ≤ 105) — the number of Gava's unsigned integer datatypes' sizes. The second line contains a single-space-separated list of *n* integers (1 ≤ *a**i* ≤ 109) — sizes of datatypes in bits. Some datatypes may have equal sizes.
     34 
     35 Output
     36 
     37 Print "YES" if Tuftuf will stop using Gava, and "NO" otherwise.
     38 
     39 Examples
     40 
     41 Input
     42 
     43 ```
     44 3  
     45 64 16 32
     46 ```
     47 
     48 Output
     49 
     50 ```
     51 NO
     52 ```
     53 
     54 Input
     55 
     56 ```
     57 4  
     58 4 2 1 3
     59 ```
     60 
     61 Output
     62 
     63 ```
     64 YES
     65 ```
     66 
     67 Note
     68 
     69 In the second example, *x* = 7 (1112) fits in 3 bits, but *x*2 = 49 (1100012) does not fit in 4 bits.