309832: CF1742B. Increasing

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:2 Solved:0

Description

Increasing

题意翻译

给定一个长为 $n$ 的序列 $a$,判断你是否能通过重排的方式使序列严格递增。 严格递增:形式上的,有 $a_1<a_2<\dots<a_n$。

题目描述

You are given an array $ a $ of $ n $ positive integers. Determine if, by rearranging the elements, you can make the array strictly increasing. In other words, determine if it is possible to rearrange the elements such that $ a_1 < a_2 < \dots < a_n $ holds.

输入输出格式

输入格式


The first line contains a single integer $ t $ ( $ 1 \leq t \leq 100 $ ) — the number of test cases. The first line of each test case contains a single integer $ n $ ( $ 1 \leq n \leq 100 $ ) — the length of the array. The second line of each test case contains $ n $ integers $ a_i $ ( $ 1 \leq a_i \leq 10^9 $ ) — the elements of the array.

输出格式


For each test case, output "YES" (without quotes) if the array satisfies the condition, and "NO" (without quotes) otherwise. You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and "YES" will be recognized as a positive answer).

输入输出样例

输入样例 #1

3
4
1 1 1 1
5
8 7 1 3 4
1
5

输出样例 #1

NO
YES
YES

说明

In the first test case any rearrangement will keep the array $ [1,1,1,1] $ , which is not strictly increasing. In the second test case, you can make the array $ [1,3,4,7,8] $ .

Input

题意翻译

给定一个长为 $n$ 的序列 $a$,判断你是否能通过重排的方式使序列严格递增。 严格递增:形式上的,有 $a_1<a_2<\dots<a_n$。

Output

题目大意:给定一个长度为 $ n $ 的正整数数组 $ a $,判断是否可以通过重新排列数组使得数组严格递增,即对于所有的 $ 1 \leq i < n $,都有 $ a_i < a_{i+1} $。

输入输出格式:

输入格式:
- 第一行包含一个整数 $ t $($ 1 \leq t \leq 100 $),表示测试用例的数量。
- 每个测试用例的第一行包含一个整数 $ n $($ 1 \leq n \leq 100 $),表示数组的长度。
- 每个测试用例的第二行包含 $ n $ 个整数 $ a_i $($ 1 \leq a_i \leq 10^9 $),表示数组的元素。

输出格式:
- 对于每个测试用例,如果可以通过重新排列使得数组严格递增,输出 "YES"(不包含引号);否则输出 "NO"(不包含引号)。
- 答案的输出大小写不敏感,即 "yEs"、"yes"、"Yes" 和 "YES" 都会被认为是肯定的答案。

输入输出样例:

输入样例 #1:
```
3
4
1 1 1 1
5
8 7 1 3 4
1
5
```

输出样例 #1:
```
NO
YES
YES
```

说明:
- 在第一个测试用例中,无论如何重新排列,数组 [1,1,1,1] 都不会是严格递增的。
- 在第二个测试用例中,可以将数组重新排列为 [1,3,4,7,8],满足严格递增的条件。题目大意:给定一个长度为 $ n $ 的正整数数组 $ a $,判断是否可以通过重新排列数组使得数组严格递增,即对于所有的 $ 1 \leq i < n $,都有 $ a_i < a_{i+1} $。 输入输出格式: 输入格式: - 第一行包含一个整数 $ t $($ 1 \leq t \leq 100 $),表示测试用例的数量。 - 每个测试用例的第一行包含一个整数 $ n $($ 1 \leq n \leq 100 $),表示数组的长度。 - 每个测试用例的第二行包含 $ n $ 个整数 $ a_i $($ 1 \leq a_i \leq 10^9 $),表示数组的元素。 输出格式: - 对于每个测试用例,如果可以通过重新排列使得数组严格递增,输出 "YES"(不包含引号);否则输出 "NO"(不包含引号)。 - 答案的输出大小写不敏感,即 "yEs"、"yes"、"Yes" 和 "YES" 都会被认为是肯定的答案。 输入输出样例: 输入样例 #1: ``` 3 4 1 1 1 1 5 8 7 1 3 4 1 5 ``` 输出样例 #1: ``` NO YES YES ``` 说明: - 在第一个测试用例中,无论如何重新排列,数组 [1,1,1,1] 都不会是严格递增的。 - 在第二个测试用例中,可以将数组重新排列为 [1,3,4,7,8],满足严格递增的条件。

加入题单

算法标签: