A16067 | Freak Joker Process
时间限制1s
内存限制256MB
通过 / 提交0/0
题目描述
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 $A_i$ and $B_i$ where each represents the offensive and defensive value of that player.
Define $\text{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 \leq j \leq N$ ) such that $A_j>A_i$ . Define $\text{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 \leq j \leq N$ ) such that $B_j>B_i$ .
Define $\text{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 \leq j \leq N$ ) such that $\text{RankA}(j)+\text{RankB}(j)<\text{RankA}(i)+\text{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 $A_k$ increases by $1$ . If $c$ is -, then $A_k$ decreases by $1$ . ( $1\leq k\leq N$ ; $c$ is + or -)
- 2 k c – If $c$ is +, then $B_k$ increases by $1$ . If $c$ is -, then $B_k$ decreases by $1$ . ( $1\leq k\leq N$ ; $c$ is + or -)
- 3 k – Pak Chanek wants to know the value of $\text{RankOverall}(k)$ at that moment. ( $1\leq k\leq N$ )
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 $A_i$ and $B_i$ where each represents the offensive and defensive value of that player.
Define $\text{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 \leq j \leq N$ ) such that $A_j>A_i$ . Define $\text{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 \leq j \leq N$ ) such that $B_j>B_i$ .
Define $\text{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 \leq j \leq N$ ) such that $\text{RankA}(j)+\text{RankB}(j)<\text{RankA}(i)+\text{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 $A_k$ increases by $1$ . If $c$ is -, then $A_k$ decreases by $1$ . ( $1\leq k\leq N$ ; $c$ is + or -)
- 2 k c – If $c$ is +, then $B_k$ increases by $1$ . If $c$ is -, then $B_k$ decreases by $1$ . ( $1\leq k\leq N$ ; $c$ is + or -)
- 3 k – Pak Chanek wants to know the value of $\text{RankOverall}(k)$ at that moment. ( $1\leq k\leq N$ )
输入格式
The first line contains a single integer $N$ ( $1\leq N\leq10^5$ ) — the number of superstar players.
The second line contains $N$ integers $A_1, A_2, A_3 \ldots, A_N$ ( $1 \leq A_i \leq 10^5$ ) — the offensive value of each player.
The third line contains $N$ integers $B_1, B_2, B_3 \ldots, B_N$ ( $1 \leq B_i \leq 10^5$ ) — the defensive value of each player.
The fourth line contains a single integer $Q$ ( $1\leq Q\leq10^5$ ) — 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 $A_i$ and $B_i$ is always between $1$ and $10^5$ inclusive. There is at least one event of type $3$ .
The second line contains $N$ integers $A_1, A_2, A_3 \ldots, A_N$ ( $1 \leq A_i \leq 10^5$ ) — the offensive value of each player.
The third line contains $N$ integers $B_1, B_2, B_3 \ldots, B_N$ ( $1 \leq B_i \leq 10^5$ ) — the defensive value of each player.
The fourth line contains a single integer $Q$ ( $1\leq Q\leq10^5$ ) — 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 $A_i$ and $B_i$ is always between $1$ and $10^5$ inclusive. There is at least one event of type $3$ .
输出格式
For each event of type $3$ , output a line containing an integer representing the value of $\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 $8$ -th event, $A=[3,2,1,3,2]$ and $B=[3,6,1,4,1]$ . It can be obtained that the values of $\text{RankA}$ and $\text{RankB}$ for each player are as follows:
- $\text{RankA}(1)=1$ , $\text{RankB}(1)=3$
- $\text{RankA}(2)=3$ , $\text{RankB}(2)=1$
- $\text{RankA}(3)=5$ , $\text{RankB}(3)=4$
- $\text{RankA}(4)=1$ , $\text{RankB}(4)=2$
- $\text{RankA}(5)=3$ , $\text{RankB}(5)=4$
So it can be obtained that $\text{RankOverall}(1)=2$ .
- $\text{RankA}(1)=1$ , $\text{RankB}(1)=3$
- $\text{RankA}(2)=3$ , $\text{RankB}(2)=1$
- $\text{RankA}(3)=5$ , $\text{RankB}(3)=4$
- $\text{RankA}(4)=1$ , $\text{RankB}(4)=2$
- $\text{RankA}(5)=3$ , $\text{RankB}(5)=4$
So it can be obtained that $\text{RankOverall}(1)=2$ .
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted