AT_abc462_c.Not Covered Points
普及-
通过率:0%
时间限制:2.00s
内存限制:1024MB
AC君温馨提醒
该题目为【atcoder】题库的题目,您提交的代码将被提交至atcoder进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
There are N points numbered 1 through N on a two-dimensional plane. Point i (1≤i≤N) has coordinates (Xi,Yi). Here, it is guaranteed that X and Y are each permutations of (1,2,…,N).
Find the number of values of i such that the interior (not including the boundary) of the rectangle with sides parallel to the x-axis and y-axis, with lower-left vertex (0,0) and upper-right vertex (Xi,Yi), contains none of the N points numbered 1 through N.
平面上有 N 个编号为 1 至 N 的点。点 i (1≤i≤N) 的坐标为 (Xi,Yi)。其中保证 X 和 Y 均为 (1,2,…,N) 的一个排列。
求满足如下条件的 i 的个数:以 (0,0) 为左下角顶点、(Xi,Yi) 为右上角顶点,且边分别与 x-轴和 y-轴平行的矩形的内部(不包含边界)中,不包含编号为 1 至 N 的任意一个点。
输入格式
The input is given from Standard Input in the following format:
N
X1 Y1
X2 Y2
⋮
XN YN
输入从标准输入给出,格式如下:
N
X1 Y1
X2 Y2
⋮
XN YN
输出格式
Output the answer.
输出答案。
输入输出样例
输入#1
3 2 1 1 3 3 2
输出#1
2
输入#2
5 1 1 4 2 2 3 5 5 3 4
输出#2
1
输入#3
7 3 4 6 1 5 5 2 7 7 2 1 3 4 6
输出#3
2
说明/提示
Sample 1 Explanation:
The two values i=1,2 satisfy the condition.
For i=3, the interior (not including the boundary) of the rectangle with sides parallel to the x-axis, with lower-left vertex (0,0) and upper-right vertex (3,2), contains point 1.
Constraints
- 1≤N≤3×105
- 1≤Xi,Yi≤N
- X and Y are each permutations of (1,2,…,N).
- All input values are integers.
样例 1 解释:
满足条件的 i 值有两个:i=1,2。
对于 i=3,以 (0,0) 为左下角顶点、(3,2) 为右上角顶点、且边与 x 轴平行的矩形(不包含边界)内部包含点 1。
约束条件
- 1≤N≤3×105
- 1≤Xi,Yi≤N
- X 和 Y 各自均为 (1,2,…,N) 的一个排列。
- 所有输入值均为整数。
输入解题思路,AI测评打分。不知道怎么写?