DoorDashOA #4
Discount Events
Estimated MediumJudge-ready
Topics (AI-labelled)Prefix & RangesIn-place Arrays
This problem has the same operation semantics as DoorDash #1 Adjust Prices; it keeps the original number #4 and its company tag. Operation 1 x v sets item x to v; operation 2 v v raises the prices below v to v. The original example is kept as public example 1, and this site adds two more examples. The bounds and input protocol explicitly listed on the page are all CSWork supplements.
Input
The first line contains n q, the second line contains n initial prices, and each of the next q lines contains three integers. Operation 1 x v is a point assignment; operation 2 v v is a global lower bound (the third v is repeated per the source format). CSWork-supplemented ranges: 1≤n,q≤100000, and all prices and v are in 1..10^9; indices start from 1.
Output
Output the n prices after executing all operations in order.
Example 1
Input:
3 3
7 5 4
2 6 6
1 2 9
2 8 8
Output:
8 9 8
Example 2
Input:
1 2
1
1 1 9
2 4 4
Output:
9
Example 3
Input:
2 2
10 20
2 10 10
1 1 1
Output:
1 20
Example notes
The editorial is written separately for this number and its original example.
Editorial
Loading solution…