#7382. 求逆序对
求逆序对
Description
给定一个序列,如果存在i<j并且a~i~>a~j~,,那么我们称之为逆序对,求逆序对的数目。
Input Format
第一行为,表示序列长度,接下来的行,第行表示序列中的第个数。
Output Format
所有逆序对总数。
4
3
2
3
2
3
Hint
。
给定一个序列a1,a2,…,an,如果存在i<j并且a~i~>a~j~,,那么我们称之为逆序对,求逆序对的数目。
第一行为n,表示序列长度,接下来的n行,第i+1行表示序列中的第i个数。
所有逆序对总数。
4
3
2
3
2
3
N≤105,A_i≤105。
By signing up a 津桥OJ universal account, you can submit code and join discussions in all online judging services provided by us.