command
Version:
v0.0.0-...-0b623e9
Opens a new window with list of versions in this module.
Published: Jun 14, 2022
License: MIT
Opens a new window with license information.
Imports: 2
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
README
¶
题目
给定一个长度为 $n$ 的整数数列,请你计算数列中的逆序对的数量。
逆序对的定义如下:对于数列的第 $i$ 个和第 $j$ 个元素,如果满足 $i < j$ 且 $a[i] > a[j]$,则其为一个逆序对;否则不是。
输入格式
第一行包含整数 $n$,表示数列的长度。
第二行包含 $n$ 个整数,表示整个数列。
输出格式
输出一个整数,表示逆序对的个数。
数据范围
$1 \le n \le 100000$,
数列中的元素的取值范围 $[1,10^9]$。
输入样例:
6
2 3 4 5 6 1
输出样例:
5
题解
前置题目:0787
前置知识:归并排序
本题知识:基础算法-归并排序
Documentation
¶
There is no documentation for this package.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.