CF1866F.Freak Joker Process

NOI/NOI+/CTSC

通过率:0%

时间限制:5.00s

内存限制:1024MB

AC君温馨提醒

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

题目描述

After the success of the basketball teams formed and trained by Pak Chanek last year (Basketball Together), Pak Chanek wants to measure the performance of each player that is considered as a superstar.

There are NN superstar players that have been trained by Pak Chanek. At the end of the season, some calculations will be made on the performance of the NN players using an international method. Each player has two values AiA_i and BiB_i where each represents the offensive and defensive value of that player.

Define RankA(i)\text{RankA}(i) as the offensive ranking of the ii-th player, whose value is c+1c+1 with cc here representing the number of jj (1≤j≤N1 \leq j \leq N) such that Aj>AiA_j \gt A_i. Define RankB(i)\text{RankB}(i) as the defensive ranking of the ii-th player, whose value is c+1c+1 with cc here representing the number of jj (1≤j≤N1 \leq j \leq N) such that Bj>BiB_j \gt B_i.

Define RankOverall(i)\text{RankOverall}(i) as the overall ranking of the ii-th player, whose value is c+1c+1 with cc here representing the number of jj (1≤j≤N1 \leq j \leq N) such that RankA(j)+RankB(j)<RankA(i)+RankB(i)\text{RankA}(j)+\text{RankB}(j) \lt \text{RankA}(i)+\text{RankB}(i).

During the next QQ days, exactly one event will happen on each day. Each event is one of the three following possibilities:

  • 1 k c – If cc is +, then AkA_k increases by 11. If cc is -, then AkA_k decreases by 11. (1≤k≤N1\leq k\leq N; cc is + or -)
  • 2 k c – If cc is +, then BkB_k increases by 11. If cc is -, then BkB_k decreases by 11. (1≤k≤N1\leq k\leq N; cc is + or -)
  • 3 k – Pak Chanek wants to know the value of RankOverall(k)\text{RankOverall}(k) at that moment. (1≤k≤N1\leq k\leq N)

在 Pak Chanek 去年成功组建并训练篮球队(“同心篮球”)之后,Pak Chanek 希望评估每位被视作超级明星的球员的表现。

共有 NN 名由 Pak Chanek 训练的超级明星球员。赛季末,将采用一种国际通用方法,对这 NN 名球员的表现进行若干计算。每名球员有两个数值 AiA_i 和 BiB_i,分别代表该球员的进攻能力值和防守能力值。

定义 RankA(i)\text{RankA}(i) 为第 ii 名球员的进攻排名,其值为 c+1c+1,其中 cc 表示满足 Aj>AiA_j \gt A_i 的下标 jj 的个数(1≤j≤N1 \leq j \leq N)。
定义 RankB(i)\text{RankB}(i) 为第 ii 名球员的防守排名,其值为 c+1c+1,其中 cc 表示满足 Bj>BiB_j \gt B_i 的下标 jj 的个数(1≤j≤N1 \leq j \leq N)。

定义 RankOverall(i)\text{RankOverall}(i) 为第 ii 名球员的综合排名,其值为 c+1c+1,其中 cc 表示满足 RankA(j)+RankB(j)<RankA(i)+RankB(i)\text{RankA}(j)+\text{RankB}(j) \lt \text{RankA}(i)+\text{RankB}(i) 的下标 jj 的个数(1≤j≤N1 \leq j \leq N)。

接下来的 QQ 天中,每天恰好发生一个事件。每个事件为以下三种类型之一:

  • 1 k c — 若 cc 为 +,则 AkA_k 增加 11;若 cc 为 -,则 AkA_k 减少 11。(1≤k≤N1\leq k\leq N;cc 为 + 或 -)
  • 2 k c — 若 cc 为 +,则 BkB_k 增加 11;若 cc 为 -,则 BkB_k 减少 11。(1≤k≤N1\leq k\leq N;cc 为 + 或 -)
  • 3 k — Pak Chanek 想知道此时 RankOverall(k)\text{RankOverall}(k) 的值。(1≤k≤N1\leq k\leq N)

输入格式

The first line contains a single integer NN (1≤N≤1051\leq N\leq10^5) — the number of superstar players.

The second line contains NN integers A1,A2,A3…,ANA_1, A_2, A_3 \ldots, A_N (1≤Ai≤1051 \leq A_i \leq 10^5) — the offensive value of each player.

The third line contains NN integers B1,B2,B3…,BNB_1, B_2, B_3 \ldots, B_N (1≤Bi≤1051 \leq B_i \leq 10^5) — the defensive value of each player.

The fourth line contains a single integer QQ (1≤Q≤1051\leq Q\leq10^5) — the number of events.

The jj-th of the next QQ lines contains the jj-th event as described. At any moment, each value of AiA_i and BiB_i is always between 11 and 10510^5 inclusive. There is at least one event of type 33.

第一行包含一个整数 NN(1≤N≤1051\leq N\leq10^5)——超级明星球员的数量。

第二行包含 NN 个整数 A1,A2,A3…,ANA_1, A_2, A_3 \ldots, A_N(1≤Ai≤1051 \leq A_i \leq 10^5)——每位球员的进攻值。

第三行包含 NN 个整数 B1,B2,B3…,BNB_1, B_2, B_3 \ldots, B_N(1≤Bi≤1051 \leq B_i \leq 10^5)——每位球员的防守值。

第四行包含一个整数 QQ(1≤Q≤1051\leq Q\leq10^5)——事件的数量。

接下来的 QQ 行中,第 jj 行描述第 jj 个事件。在任意时刻,每个 AiA_i 和 BiB_i 的值始终在 11 到 10510^5(含端点)之间。至少存在一个类型为 33 的事件。

输出格式

For each event of type 33, output a line containing an integer representing the value of RankOverall(k)\text{RankOverall}(k) at that moment.

对于每个类型为 33 的事件,输出一行,包含一个整数,表示此时 RankOverall(k)\text{RankOverall}(k) 的值。

输入输出样例

  • 输入#1

    5
    3 3 1 3 2
    3 7 1 3 1
    8
    3 1
    3 2
    2 4 +
    1 2 -
    3 2
    3 3
    2 2 -
    3 1

    输出#1

    2
    1
    2
    5
    2

说明/提示

At the 88-th event, A=[3,2,1,3,2]A=[3,2,1,3,2] and B=[3,6,1,4,1]B=[3,6,1,4,1]. It can be obtained that the values of RankA\text{RankA} and RankB\text{RankB} for each player are as follows:

  • RankA(1)=1\text{RankA}(1)=1, RankB(1)=3\text{RankB}(1)=3
  • RankA(2)=3\text{RankA}(2)=3, RankB(2)=1\text{RankB}(2)=1
  • RankA(3)=5\text{RankA}(3)=5, RankB(3)=4\text{RankB}(3)=4
  • RankA(4)=1\text{RankA}(4)=1, RankB(4)=2\text{RankB}(4)=2
  • RankA(5)=3\text{RankA}(5)=3, RankB(5)=4\text{RankB}(5)=4

So it can be obtained that RankOverall(1)=2\text{RankOverall}(1)=2.

在第 88 次活动中,A=[3,2,1,3,2]A=[3,2,1,3,2],B=[3,6,1,4,1]B=[3,6,1,4,1]。可得每位选手的 RankA\text{RankA} 和 RankB\text{RankB} 值如下:

  • RankA(1)=1\text{RankA}(1)=1,RankB(1)=3\text{RankB}(1)=3
  • RankA(2)=3\text{RankA}(2)=3,RankB(2)=1\text{RankB}(2)=1
  • RankA(3)=5\text{RankA}(3)=5,RankB(3)=4\text{RankB}(3)=4
  • RankA(4)=1\text{RankA}(4)=1,RankB(4)=2\text{RankB}(4)=2
  • RankA(5)=3\text{RankA}(5)=3,RankB(5)=4\text{RankB}(5)=4

因此可得 RankOverall(1)=2\text{RankOverall}(1)=2。

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

首页