QOJ.ac

QOJ

Time Limit: 3 s Memory Limit: 1024 MB Total points: 100

#8358. 黑白点

统计

平面上给定 $n$ 个黑点,进行 $m$ 轮操作,每轮加入一个白点。

你需要在每次加点操作后求出:最少删去多少黑点和白点使得不存在黑点 $(x,y)$ 和白点 $(x', y')$ 满足 $x\leq x',y\leq y'$。

输入格式

第一行一个整数 $n$ 表示黑点个数。

接下来 $n$ 行每行两个整数 $x_i,y_i$ 表示第 $i$ 个黑点的坐标。

接下来一行一个整数 $m$ 表示操作轮数。

接下来 $m$ 行每行两个整数 $x_i,y_i$ 表示第 $i$ 次加入的白点坐标。

输出格式

$m$ 行,每行一个整数表示第 $i$ 次操作后的答案。

样例一

input

3
1 1
2 2
3 3
4
1 1
2 2
1 1
4 4


output

1
2
2
3


数据范围与提示

子任务编号 $n,m\leq$ 特殊性质 分值
$1$ $50$ $13$
$2$ $1000$ $28$
$3$ $100000$ 所有点 $x_i=y_i$ $17$
$4$ $100000$ $42$

对于所有数据,保证 $1\leq n,m\leq 100000,1\leq x_i,y_i\leq 10^9$。

时间限制:$3\texttt{s}$

空间限制:$512\texttt{MB}$

About Issues

We understand that our problem archive is not perfect. If you find any issues with the problem, including the statement, scoring configuration, time/memory limits, test cases, etc.

You may use this form to submit an issue regarding the problem. A problem moderator will review your issue and proceed it properly.

STOP! Before you submit an issue, please READ the following guidelines:

  1. This is not a place to publish a discussion, editorial, or requests to debug your code. Your issue will only be visible by you and problem moderators. Other users will not be able to view or reply your issues.
  2. Do not submit duplicated issues. If you have already submitted one, please wait for an moderator to review it. Submitting multiple issues will not speed up the review process and might cause your account to be banned.
  3. Issues must be filed in English or Chinese only.
  4. Be sure your issue is related to this problem. If you need to submit an issue regarding another problem, contest, category, etc., you should submit it to the corresponding page.

Active Issues 0

No issues in this category.

Closed/Resolved Issues 0

No issues in this category.