Time limit: 3 sec
Now a days sorting is a common sub problem in programming contest. So many programmers want to simplify the complexity of sorting algorithm. Garbage, the best programmer of HSTU develops an efficient sorting algorithm. But there is a problem, only 80% times it gives the right ans. So Garbage start debugging and realize that 15% times just one swap needs to make the array sorted. So an array that is sorted using Garbage’s algorithm will be one of this three types given bellow…
- Fully sorted
- Require one swapping that makes the array sorted
- Require more than one swapping to sort the array
Your task is to identify this terms. [NB: Garbage sort is a non-decreasing order sort]
Each test case contains two lines. (Maximum test case 150 )
First line there will be an integer N that denotes the number of elements of this array. (0<=N<=100000). N=0 means that the program will terminate.
Second line there will be N integers (arr,arr,arr,…….,arr[N]) , represent the elements of an array that is sorted using Garbage’s algorithm. [0<=arr[i]<= 100000000].
For each test case first print the test cases.
- For fully sorted array: print “OK”
- For require one swapping that makes the array sorted: print “YES value1 value 2” where value1, value2 are the swapping values and value1<value2.
- For require more than one swapping to sort the array: print “NO”.
[Input file is huge. Use faster input output system.]
1 2 3 4
4 2 3 1
4 3 2 1
CASE 1 : OK
CASE 2 : YES 1 4
CASE 3 : NO