CF108B.Datatypes

普及/提高-

通过率:0%

时间限制:2.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

Tattah's youngest brother, Tuftuf, is new to programming.

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.

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.

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.

Your task is to determine Tuftuf's destiny.

塔塔赫最小的弟弟图夫图夫刚刚开始学习编程。

由于他哥哥是一位非常优秀的程序员,他最大的梦想就是超越哥哥。图夫图夫是开罗德国大学(GUC)的一名学生,正在学习用 Gava 编写程序。

今天,图夫图夫接触了 Gava 中的无符号整数数据类型。Gava 共有 $ n $ 种无符号整数数据类型,其位宽(以比特为单位)分别为 $ a_1,,a_2,,\dots,,a_n $。其中第 $ i $ 种类型的位宽为 $ a_i $ 比特,因此它可以表示 $ 0 $ 到 $ 2^{a_i} - 1 $(含端点)之间的所有整数。

图夫图夫正在考虑学习一门更好的编程语言。如果存在某个整数 $ x $,使得 $ x $ 能被某种类型 $ i $(位宽为 $ a_i $ 比特)精确表示,但 $ x \cdot x $ 却无法被另一种类型 $ j $(位宽为 $ a_j $ 比特)表示,且满足 $ a_i < a_j $,那么图夫图夫将彻底放弃使用 Gava。

你的任务是判断图夫图夫的命运。

输入格式

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.

第一行包含一个整数 nn(2≤n≤1052 \leq n \leq 10^5)—— 表示 Gava 语言中无符号整数数据类型的种类数。
第二行包含 nn 个以单个空格分隔的整数(1≤ai≤1091 \leq a_i \leq 10^9)—— 表示各数据类型所占的位数(比特数)。某些数据类型可能具有相同的位数。

输出格式

Print "YES" if Tuftuf will stop using Gava, and "NO" otherwise.

如果Tuftuf将停止使用Gava,则输出“YES”,否则输出“NO”。

输入输出样例

  • 输入#1

    3
    64 16 32

    输出#1

    NO
  • 输入#2

    4
    4 2 1 3

    输出#2

    YES

说明/提示

In the second example, x = 7 (1112) fits in 3 bits, but _x_2 = 49 (1100012) does not fit in 4 bits.

在第二个例子中,x=7x = 7(二进制为 1112111_2)可放入 3 位,但 x2=49x^2 = 49(二进制为 1100012110001_2)无法放入 4 位。

输入解题思路,AI测评打分。不知道怎么写?

首页