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 N 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 N players using an international method. Each player has two values Ai and Bi where each represents the offensive and defensive value of that player.
Define RankA(i) as the offensive ranking of the i-th player, whose value is c+1 with c here representing the number of j (1≤j≤N) such that Aj>Ai. Define RankB(i) as the defensive ranking of the i-th player, whose value is c+1 with c here representing the number of j (1≤j≤N) such that Bj>Bi.
Define RankOverall(i) as the overall ranking of the i-th player, whose value is c+1 with c here representing the number of j (1≤j≤N) such that RankA(j)+RankB(j)<RankA(i)+RankB(i).
During the next Q days, exactly one event will happen on each day. Each event is one of the three following possibilities:
- 1 k c – If c is +, then Ak increases by 1. If c is -, then Ak decreases by 1. (1≤k≤N; c is + or -)
- 2 k c – If c is +, then Bk increases by 1. If c is -, then Bk decreases by 1. (1≤k≤N; c is + or -)
- 3 k – Pak Chanek wants to know the value of RankOverall(k) at that moment. (1≤k≤N)
在 Pak Chanek 去年成功组建并训练篮球队(“同心篮球”)之后,Pak Chanek 希望评估每位被视作超级明星的球员的表现。
共有 N 名由 Pak Chanek 训练的超级明星球员。赛季末,将采用一种国际通用方法,对这 N 名球员的表现进行若干计算。每名球员有两个数值 Ai 和 Bi,分别代表该球员的进攻能力值和防守能力值。
定义 RankA(i) 为第 i 名球员的进攻排名,其值为 c+1,其中 c 表示满足 Aj>Ai 的下标 j 的个数(1≤j≤N)。
定义 RankB(i) 为第 i 名球员的防守排名,其值为 c+1,其中 c 表示满足 Bj>Bi 的下标 j 的个数(1≤j≤N)。
定义 RankOverall(i) 为第 i 名球员的综合排名,其值为 c+1,其中 c 表示满足 RankA(j)+RankB(j)<RankA(i)+RankB(i) 的下标 j 的个数(1≤j≤N)。
接下来的 Q 天中,每天恰好发生一个事件。每个事件为以下三种类型之一:
1 k c— 若 c 为+,则 Ak 增加 1;若 c 为-,则 Ak 减少 1。(1≤k≤N;c 为+或-)2 k c— 若 c 为+,则 Bk 增加 1;若 c 为-,则 Bk 减少 1。(1≤k≤N;c 为+或-)3 k— Pak Chanek 想知道此时 RankOverall(k) 的值。(1≤k≤N)
输入格式
The first line contains a single integer N (1≤N≤105) — the number of superstar players.
The second line contains N integers A1,A2,A3…,AN (1≤Ai≤105) — the offensive value of each player.
The third line contains N integers B1,B2,B3…,BN (1≤Bi≤105) — the defensive value of each player.
The fourth line contains a single integer Q (1≤Q≤105) — the number of events.
The j-th of the next Q lines contains the j-th event as described. At any moment, each value of Ai and Bi is always between 1 and 105 inclusive. There is at least one event of type 3.
第一行包含一个整数 N(1≤N≤105)——超级明星球员的数量。
第二行包含 N 个整数 A1,A2,A3…,AN(1≤Ai≤105)——每位球员的进攻值。
第三行包含 N 个整数 B1,B2,B3…,BN(1≤Bi≤105)——每位球员的防守值。
第四行包含一个整数 Q(1≤Q≤105)——事件的数量。
接下来的 Q 行中,第 j 行描述第 j 个事件。在任意时刻,每个 Ai 和 Bi 的值始终在 1 到 105(含端点)之间。至少存在一个类型为 3 的事件。
输出格式
For each event of type 3, output a line containing an integer representing the value of RankOverall(k) at that moment.
对于每个类型为 3 的事件,输出一行,包含一个整数,表示此时 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 8-th event, A=[3,2,1,3,2] and B=[3,6,1,4,1]. It can be obtained that the values of RankA and RankB for each player are as follows:
- RankA(1)=1, RankB(1)=3
- RankA(2)=3, RankB(2)=1
- RankA(3)=5, RankB(3)=4
- RankA(4)=1, RankB(4)=2
- RankA(5)=3, RankB(5)=4
So it can be obtained that RankOverall(1)=2.
在第 8 次活动中,A=[3,2,1,3,2],B=[3,6,1,4,1]。可得每位选手的 RankA 和 RankB 值如下:
- RankA(1)=1,RankB(1)=3
- RankA(2)=3,RankB(2)=1
- RankA(3)=5,RankB(3)=4
- RankA(4)=1,RankB(4)=2
- RankA(5)=3,RankB(5)=4
因此可得 RankOverall(1)=2。
输入解题思路,AI测评打分。不知道怎么写?