#T738. 求逆序对
求逆序对
Description
Given a sequence , if there exists a pair such that and , then it is called an inversion pair. The task is to count the total number of inversion pairs.
Input Format
The first line contains , representing the length of the sequence. The next lines each contain one element of the sequence, where the -th line corresponds to the -th element of the sequence.
Output Format
The total number of inversion pairs.
4
3
2
3
2
3
Source
CodesOnline