把sort排序出的数组存储起来然后一一比对,位置不符合的就说明发生了jiao'huan
Sort PRoblem | ||||||
| ||||||
Description | ||||||
You have a sequence of N (1 <= N <= 10 000) numbers (none of the numbers is equal to others), can you let the sequence become ascending within N movements. | ||||||
Input | ||||||
There are multiple test cases. The first line is a positive integer T, indicating the number of test cases. For each test case: Line 1. A positive integer N. Line 2. This line contains N integers: a1, a2, ..., ai, ...,an (0 < ai <= 2 000 000 000) separated by space. | ||||||
Output | ||||||
For each test case, output m at the first line. m is the times of Operation. Then m lines follows. Each line consists two integer x, y meaning that you will change the number on position x and the number on position y. | ||||||
Sample Input | ||||||
332 3 151 2 5 3 41011 3 17 19 7 2 20 15 10 13 | ||||||
Sample Output | ||||||
21 32 323 44 571 63 54 95 66 107 88 10 | ||||||
Source | ||||||
哈理工2013春季校赛 - 现场赛 |
新闻热点
疑难解答