#P1866F. Freak Joker Process
Freak Joker Process
No submission language available for this problem.
Description
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 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 players using an international method. Each player has two values and where each represents the offensive and defensive value of that player.
Define as the offensive ranking of the -th player, whose value is with here representing the number of () such that . Define as the defensive ranking of the -th player, whose value is with here representing the number of () such that .
Define as the overall ranking of the -th player, whose value is with here representing the number of () such that .
During the next days, exactly one event will happen on each day. Each event is one of the three following possibilities:
- 1 k c – If is +, then increases by . If is -, then decreases by . (; is + or -)
- 2 k c – If is +, then increases by . If is -, then decreases by . (; is + or -)
- 3 k – Pak Chanek wants to know the value of at that moment. ()
The first line contains a single integer () — the number of superstar players.
The second line contains integers () — the offensive value of each player.
The third line contains integers () — the defensive value of each player.
The fourth line contains a single integer () — the number of events.
The -th of the next lines contains the -th event as described. At any moment, each value of and is always between and inclusive. There is at least one event of type .
For each event of type , output a line containing an integer representing the value of at that moment.
Input
The first line contains a single integer () — the number of superstar players.
The second line contains integers () — the offensive value of each player.
The third line contains integers () — the defensive value of each player.
The fourth line contains a single integer () — the number of events.
The -th of the next lines contains the -th event as described. At any moment, each value of and is always between and inclusive. There is at least one event of type .
Output
For each event of type , output a line containing an integer representing the value of at that moment.
Note
At the -th event, and . It can be obtained that the values of and for each player are as follows:
- ,
- ,
- ,
- ,
- ,
So it can be obtained that .