| Teamscode Spring 2023 Contest |
|---|
| Finished |
Note the higher time limit than usual.
You are given an array $$$a$$$ of $$$n$$$ integers and $$$q$$$ queries to process.
Each query consists of three integers, $$$l$$$, $$$r$$$ and $$$x$$$, and indicates that each value of $$$a$$$ between $$$l$$$ and $$$r$$$, inclusive, is incremented by $$$x$$$. Note that the updates are not independent, so the increments persist for the following queries.
After each query, print the minimum $$$i$$$ that satisfies the following conditions:
The first line contains two integers, $$$n$$$ and $$$q$$$, the size of the array and the number of queries, respectively. $$$(2 \leq n \leq 10^{6}; 1 \leq q \leq 10^{6})$$$.
The next line contains $$$n$$$ integers, $$$a_{1}a_{2}\ldots a_{n}$$$. $$$(-10^{9} \leq a_{i} \leq 10^{9})$$$.
The following $$$q$$$ lines will each contain three integers, $$$l$$$, $$$r$$$ and $$$x$$$. $$$(1 \leq l \leq r \leq n; 1 \leq x \leq 10^{9})$$$.
It is guaranteed that the sum of $$$(r - l + 1) \cdot x$$$ over all queries is never greater than $$$10^{18}$$$.
$$$-$$$
Testcases in the subtasks are numbered from $$$1−20$$$ with samples skipped.
For testcases $$$1-5$$$, $$$2 \le n \le 1000$$$ and $$$1 \le q \le 1000$$$.
The remaining testcases do not satisfy any additional constraints.
For each query, output the minimum $$$i$$$ that satisfies the following conditions:
6 5 2 -1 1 0 0 1 4 5 1 1 1 4 2 2 9 4 6 20 1 1 3
3 -1 2 2 4
5 10 9 -17 -6 1 -58 1 4 4 3 4 5 1 4 7 5 5 1 2 2 3 5 5 6 5 5 7 2 3 10 2 4 7 2 4 7
4 3 -1 -1 -1 -1 -1 -1 -1 2
Explanation of the first sample:
$$$-$$$
Idea: Esomer
Preparation: Esomer
Ocurrences: Advanced 10
| Name |
|---|


