CF1866F.Freak Joker Process

普及/提高-

通过率:0%

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 ( 1jN1 \leq j \leq N ) such that Aj>AiA_j>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 ( 1jN1 \leq j \leq N ) such that Bj>BiB_j>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 ( 1jN1 \leq j \leq N ) such that RankA(j)+RankB(j)<RankA(i)+RankB(i)\text{RankA}(j)+\text{RankB}(j)<\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 . ( 1kN1\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 . ( 1kN1\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. ( 1kN1\leq k\leq N )

输入格式

The first line contains a single integer NN ( 1N1051\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 ( 1Ai1051 \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 ( 1Bi1051 \leq B_i \leq 10^5 ) — the defensive value of each player.

The fourth line contains a single integer QQ ( 1Q1051\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 .

输出格式

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

输入输出样例

  • 输入#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 .

首页