AT_abc462_c.Not Covered Points

普及-

通过率:0%

时间限制:2.00s

内存限制:1024MB

AC君温馨提醒

该题目为【atcoder】题库的题目,您提交的代码将被提交至atcoder进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

There are NN points numbered 11 through NN on a two-dimensional plane. Point ii (1≤i≤N)(1\le i\le N) has coordinates (Xi,Yi)(X_i,Y_i). Here, it is guaranteed that XX and YY are each permutations of (1,2,…,N)(1,2,\ldots,N).

Find the number of values of ii such that the interior (not including the boundary) of the rectangle with sides parallel to the xx-axis and yy-axis, with lower-left vertex (0,0)(0,0) and upper-right vertex (Xi,Yi)(X_i,Y_i), contains none of the NN points numbered 11 through NN.

平面上有 NN 个编号为 11 至 NN 的点。点 ii (1≤i≤N)(1\le i\le N) 的坐标为 (Xi,Yi)(X_i,Y_i)。其中保证 XX 和 YY 均为 (1,2,…,N)(1,2,\ldots,N) 的一个排列。

求满足如下条件的 ii 的个数:以 (0,0)(0,0) 为左下角顶点、(Xi,Yi)(X_i,Y_i) 为右上角顶点,且边分别与 xx-轴和 yy-轴平行的矩形的内部(不包含边界)中,不包含编号为 11 至 NN 的任意一个点。

输入格式

The input is given from Standard Input in the following format:

NN
X1X_1 Y1Y_1
X2X_2 Y2Y_2
⋮\vdots
XNX_N YNY_N

输入从标准输入给出,格式如下:

NN
X1X_1 Y1Y_1
X2X_2 Y2Y_2
⋮\vdots
XNX_N YNY_N

输出格式

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,2i=1,2 satisfy the condition.

For i=3i=3, the interior (not including the boundary) of the rectangle with sides parallel to the xx-axis, with lower-left vertex (0,0)(0,0) and upper-right vertex (3,2)(3,2), contains point 11.

Constraints

  • 1≤N≤3×1051\le N\le 3\times 10^5
  • 1≤Xi,Yi≤N1\le X_i,Y_i\le N
  • XX and YY are each permutations of (1,2,…,N)(1,2,\ldots,N).
  • All input values are integers.

样例 1 解释:
满足条件的 ii 值有两个:i=1,2i=1,2。

对于 i=3i=3,以 (0,0)(0,0) 为左下角顶点、(3,2)(3,2) 为右上角顶点、且边与 xx 轴平行的矩形(不包含边界)内部包含点 11。

约束条件

  • 1≤N≤3×1051\le N\le 3\times 10^5
  • 1≤Xi,Yi≤N1\le X_i,Y_i\le N
  • XX 和 YY 各自均为 (1,2,…,N)(1,2,\ldots,N) 的一个排列。
  • 所有输入值均为整数。

输入解题思路,AI测评打分。不知道怎么写?

首页