QOJ.ac

QOJ

Time Limit: 6 s Memory Limit: 512 MB Total points: 100

#8949. ヘルウェスティア

統計

$n$ 個の点 $(x_i, y_i)_{i=1}^n$ が与えられます。以下の $m$ 回の操作を順番に処理してください。各操作では $o, x, y, X, Y$ が与えられます。

  • まず、以下の修正を行います。
    • $o=1$ の場合、$x_i \le x$ かつ $y_i \le y$ を満たす点について、$y_i$ を $y$ に変更します。
    • $o=2$ の場合、$x_i \le x$ かつ $y_i \le y$ を満たす点について、$x_i$ を $x$ に変更します。
  • その後、クエリとして、$x_i \le X$ かつ $y_i \le Y$ を満たす点の個数を求めます。

入力

1 行目に 2 つの整数 $n, m$ が与えられます。

続く $n$ 行に、各点の座標 $x_i, y_i$ が与えられます。

続く $m$ 行に、各操作を表す 5 つの整数 $o, x, y, X, Y$ が与えられます。

出力

合計 $m$ 行出力してください。各行には、各操作におけるクエリの答えを順番に出力してください。

入出力例

入力 1

5 6
1 2
3 1
5 1
3 5
4 4
1 4 2 5 4
1 4 3 5 3
2 3 5 1 3
2 2 3 1 4
1 3 3 1 4
2 5 5 2 1

出力 1

4
3
0
0
0
0

小課題

すべてのデータにおいて、$1 \le n, m \le 10^6$、$1 \le x_i, y_i, x, y, X, Y \le n$ を満たします。

小課題 1(10 点):$n, m \le 10^3$

小課題 2(20 点):$x_i, y_i, x, y, X, Y$ は $1$ から $n$ の範囲で一様ランダムに選ばれる。

小課題 3(20 点):$o=1$

小課題 4(20 点):$n, m \le 3 \times 10^5$、小課題 1 に依存する。

小課題 5(30 点):特別な制約なし、小課題 1, 2, 3, 4 に依存する。

Editorials

IDTypeStatusTitlePosted ByLast UpdatedActions
EditorialOpen Official EditorialQingyu- Download

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.