Toggle navigation
点码成金编程
F.A.Qs
ProblemSet
Source/Category
Status
Ranklist
Contest
Login
Home
=>
ProblemSet
=> 3.16-05:【模板】二维偏序
Problem2048--3.16-05:【模板】二维偏序
2048: 3.16-05:【模板】二维偏序
Time Limit:
1
Sec
Memory Limit:
128 MB
Submit:
0
Solved:
2
[
Submit
] [
Status
] [ Creator:
][ 参考程序 ]
Description
有 n 个元素,每个元素有 ai、bi 两个属性,求 aj≤ai 且 bj≤bi 且 i≠j 的数对 (i,j) 的个数
Input
第一行一个数 n ,表示元素个数
第二行至第 n+1 行,每行两个整数 ai、bi ,分别表示两个属性值
Output
输出一行,表示数对 (i,j) 的个数
Sample Input
Copy
5 2 1 2 3 4 3 3 2 3 3
Sample Output
Copy
9
HINT
对于 30% 的数据,1≤n≤5000
对于 100% 的数据,1≤n≤100000,1≤ai,bi≤n
Source/Category
分治
线段树
树状数组