小强盗女孩喜欢在动物园里吓唬动物取乐。她决定把动物按高度不减的顺序排成一排。然而,这些动物非常害怕,以至于他们无法呆在正确的地方。
女孩起初很生气,但后来她决定自己安排动物。她反复给出一个区间,区间的左右边界分别为l和r,且区间内的元素个数为偶数,即r-l+1为偶数。之后,l和r之间位置的动物被重新排列如下:l位置的动物与l+1位置的动物互换位置,l+2位置的动物和l+3位置的动物互换位置,……,最后,r-1位置的宠物与r位置的动物交换位置。
帮助女孩按照不降度顺序排列动物。每次最多进行20000次交换就可以完成排序,否则女孩会变得无聊,并再次开始惊吓动物。
题目描述
Little Robber Girl likes to scare animals in her zoo for fun. She decided to arrange the animals in a row in the order of non-decreasing height. However, the animals were so scared that they couldn't stay in the right places.
The robber girl was angry at first, but then she decided to arrange the animals herself. She repeatedly names numbers l and r such that r−l+1 is even. After that animals that occupy positions between l and r inclusively are rearranged as follows: the animal at position l swaps places with the animal at position l+1 , the animal l+2 swaps with the animal l+3 , ..., finally, the animal at position r−1 swaps with the animal r .
Help the robber girl to arrange the animals in the order of non-decreasing height. You should name at most 2000020000 segments, since otherwise the robber girl will become bored and will start scaring the animals again.
输入格式
The first line contains a single integer n ( 1<=n<=100 ) — number of animals in the robber girl's zoo.
The second line contains n space-separated integers a1,a2,...,an ( 1<=ai<=109 ), where ai is the height of the animal occupying the i -th place.
输出格式
Output
Print the sequence of operations that will rearrange the animals by non-decreasing height.
The output should contain several lines,
i-th of the lines should contain two space-separated integers
li and
ri (
1≤li<ri≤n)− desc
riptions of segments the robber girl should name. The segments should be described in the order the operations are performed.
The number of operations should not exceed 20000.
If the animals are arranged correctly from the start, you are allowed to output nothing.