Combined scoreboard
You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.
Time Limit: 2.0 s
Memory Limit: 512.0 MB
Description
The result of "LUCC Carnival 2.0" programming contest has been published. There were \(N\) participants in total in the main contest.
After some day, the organizer comittee set to reply the contest for those who did not participate in the main contest. Total \(M\) people participated in the replay of the contest.
Now, the participants of the reply contest are curious to know what would be their position in the main contest scoreboard if they had participated in the main contest according to the score of the raply contest.
In other words you have to find the position of \(M\) contestants of the reply contest in the combined scoreboard of main contest and reply contest.
Note: if two contestant of reply contest have same score place him first in the combined scoreboard who comes first in the list of reply contest. And place the contestant of main contest first when two people from two contest have the same score. See the sample test case for more clarification.
Input
First line takes an integer \(N\) : number of participants in the main contest
second line takes \(N\) integers : scoreboard of main contest
third line takes an integer \(M\) : number of participants in the reply contest
fourth line takes \(M\) integers : scoreboard of reply contest
\(1 <= N,M <= 10^5\)
Score of any contestant will not exceed \(10^9\)
Output
print \(M\) integer in a single line : \(i\)-th integer should represent the position of \(i\)-th participants of reply contest in the combined scoreboard.
Note: do not print a newline in answer
Sample
Input | Output |
---|---|
|
|
in the given testcase the combined scoreboard is : 5 5 5 4 3 2 1
the positions of the participants of reply contest are marked as bold.
Brain Booster #3
- Status
- Done
- Rule
- ACM/ICPC
- Problem
- 9
- Start at
- 2024-05-06 15:00
- End at
- 2024-05-06 18:00
- Duration
- 3.0 hour(s)
- Host
- Partic.
- 91