当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

5273:Dylans loves sequence

题目描述
Dylans is given $N$ numbers $a[1]....a[N]$

And there are $Q$ questions.

Each question is like this $(L,R)$

his goal is to find the “inversions” from number $L$ to number $R$.

more formally,his needs to find the numbers of pair($x,y$),
that $L \leq x,y \leq R$ and $x < y$ and $a[x] > a[y]$
输入解释
In the first line there is two numbers $N$ and $Q$.

Then in the second line there are $N$ numbers:$a[1]..a[N]$

In the next $Q$ lines,there are two numbers $L,R$ in each line.

$N \leq 1000, Q \leq 100000, L \leq R, 1 \leq a[i] \leq 2^{31}-1$
输出解释
For each query,print the numbers of "inversions”
输入样例
3 2
3 2 1
1 2
1 3
输出样例
1
3

提示
You shouldn't print any space in each end of the line in the hack data.
来自杭电HDUOJ的附加信息
Recommend hujie

该题目是Virtual Judge题目,来自 杭电HDUOJ

题目来源 BestCoder Round #45

源链接: HDU-5273

最后修改于 2020-10-25T23:21:14+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
2000/1000MS(Java/Others) 131072/131072K(Java/Others)