#T535. 求逆序对
求逆序对
Description
Given a sequence , if there exists a pair such that and , then it is called an inversion. The task is to count the total number of inversions in the sequence.
Input Format
The first line contains , the length of the sequence. The following lines contain the elements of the sequence, where the -th line represents the -th element of the sequence.
Output Format
The total number of inversions in the sequence.
4
3
2
3
2
3
译文
CodesOnline