#2442. 队列
队列
Description
有一个长度为 n 的土拨鼠队列 ai, 我们希望由小到大排列, 但是队列并不一定是有序的, 土拨鼠辰辰可以任意交换队列中的两只鼠鼠, 但是最多只能交换一次.土拨鼠辰辰想知道, 最多交换一次后, 这个队列是否可以变为升序?
Format
Input
第一行一个整数 n . 第二行 n 个整数 ai.
Output
如果可以变为升序, 则输出 YES , 否则输出 NO .
Samples
5
1 4 3 2 5
YES
Limitation
1s, 1024KiB for each test case.
统计
相关
在下列比赛中: