#E. B - Permutation Check

    传统题 1000ms 256MiB

B - Permutation Check

该比赛已结束,您无法在比赛模式下递交该题目。您可以点击“在题库中打开”以普通模式查看和递交本题。

B - Permutation Check

Score : $200$ points

Problem Statement

You are given a sequence of $N$ integers between $1$ and $N$ (inclusive): $A = (A_1, A_2, \dots, A_N)$.

Determine whether $A$ is a permutation of $(1, 2, \dots, N)$.

Constraints

  • $1 \leq N \leq 10^3$
  • $1 \leq A_i \leq N$
  • All values in input are integers.

Input

Input is given from Standard Input in the following format:

NN

A1A_1 A2A_2 \ldots ANA_N

Output

If $A$ is a permutation of $(1, 2, \dots, N)$, print Yes; otherwise, print No.


5
3 1 2 4 5
Yes

$(3, 1, 2, 4, 5)$ is a permutation of $(1, 2, 3, 4, 5)$, so we should print Yes.


6
3 1 4 1 5 2
No

$(3, 1, 4, 1, 5, 2)$ is not a permutation of $(1, 2, 3, 4, 5, 6)$, so we should print No.


3
1 2 3
Yes

1
1
Yes

2025寒假ATC码力训练营第十一次练习

未参加
状态
已结束
规则
IOI
题目
6
开始于
2025-2-3 13:00
结束于
2025-2-3 14:30
持续时间
1.5 小时
主持人
参赛人数
5