(初中组)非直接排序
You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.
Description
给定T组数据,每组数据给定 以及长度为 的排列 (排列中元素是 ~ ),可以进行若干次操作,每次操作可以选择三个数 (),若 ,将 加上 ,否则交换 和 ,问是否能使排列单调递增。
Format
Input
第一行数据组数 。 每组数据第一行是一个正整数 ,第二行 个正整数表示一个 ~ 的排列。
Output
对于每组数据,如果可以通过操作使得排列单调递增,则输出一行 Yes
,否则输出一行 No
。
Samples
7
3
1 2 3
3
1 3 2
7
5 3 4 7 6 2 1
7
7 6 5 4 3 2 1
5
2 1 4 5 3
5
2 1 3 4 5
7
1 2 6 7 4 3 5
Yes
Yes
No
No
No
No
Yes
Limitation
。
本题采用提交至远程服务器评测的方式来进行评测,语言请选择 “G++ 17”。
水题过家家
- Status
- Done
- Rule
- IOI
- Problem
- 8
- Start at
- 2023-5-20 8:00
- End at
- 2023-5-20 12:00
- Duration
- 4 hour(s)
- Host
- Partic.
- 49