Little Deepu and Array
Practice
3.6 (65 votes)
Algorithms
Approved
Easy
Open
Trees
Problem
85% Success 11302 Attempts 20 Points 5s Time Limit 256MB Memory 1024 KB Max Code

Little Deepu loves positive things in life, positive girlfriends, positive marks. He's, in general a lover of positive things, so for obvious reasons he loves an array which contains positive elements.

Anyway, Little Deepu also thinks that not every value in his so called positive array deserves to be valued so high, so he makes an operation called HIT which takes exactly one argument, i.e., HIT (X). When HIT (X) is called, it decreases the value of all the elements of the array by 1 which are greater than X.

Now, to test how positive can you stay in life, he performs M HIT operations, and after they have been done, Deepu wants you to print the final array.

Input:
First line contains N the size of array. Second lines contains N elements of array. Third line contains an integer M next M lines contains a single integer X.

Output:
Print final array after M HIT operations.

Constraints:
1<=N<=100000
1<=A[i]<=1000000000
1<=M<=20000
1<=X<=1000000000

Please login to use the editor

You need to be logged in to access the code editor

Loading...

Please wait while we load the editor

Loading...
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:20
19 votes
Tags:
Advanced Data StructuresBit ManipulationData StructuresEasySegment Trees
Points:20
32 votes
Tags:
Advanced Data StructuresBit ManipulationData StructuresEasySegment Trees
Points:20
16 votes
Tags:
Advanced Data StructuresData StructuresEasySegment Trees