At the start of the year, I wrote a very painful implementation problem. My official solution was over 200 lines long and I was wondering if anyone could come up with a more elegant solution.
The problem is as follows:
Problem
# | User | Rating |
---|---|---|
1 | tourist | 3843 |
2 | jiangly | 3705 |
3 | Benq | 3628 |
4 | orzdevinwang | 3571 |
5 | Geothermal | 3569 |
5 | cnnfls_csy | 3569 |
7 | jqdai0815 | 3530 |
8 | ecnerwala | 3499 |
9 | gyh20 | 3447 |
10 | Rebelz | 3409 |
# | User | Contrib. |
---|---|---|
1 | maomao90 | 171 |
2 | awoo | 164 |
3 | adamant | 162 |
4 | TheScrasse | 159 |
5 | nor | 153 |
5 | maroonrk | 153 |
7 | -is-this-fft- | 152 |
8 | Petr | 146 |
9 | orz | 145 |
10 | pajenegod | 144 |
A new definition of bad implementation
At the start of the year, I wrote a very painful implementation problem. My official solution was over 200 lines long and I was wondering if anyone could come up with a more elegant solution.
The problem is as follows:
...The S value of an array is the sum of maximum values across all continuous subsequences length at least one. In the array (4,5,1), the value is 4+5+1+5+5+5=25.
You are given an array $$$A$$$ of length $$$N$$$. There are $$$N$$$ updates, where the $$$i$$$th value of the array is increased from by a value $$$B_i$$$.
Output $$$N+1$$$ integers, the S value after every update.
$$$N \leq 5 \cdot 10^5$$$
Rev. | Lang. | By | When | Δ | Comment | |
---|---|---|---|---|---|---|
en5 | dvdg6566 | 2020-11-08 12:30:17 | 0 | (published) | ||
en4 | dvdg6566 | 2020-11-08 12:29:51 | 13 | Tiny change: 'ates, are \textbf{unique}. \n\nOutp' -> 'ates, are **unique**. \n\nOutp' | ||
en3 | dvdg6566 | 2020-11-08 12:28:47 | 30 | Tiny change: ':A_Wallaby,2020-11-08]. Majorit' -> ':A_Wallaby]. Majorit' | ||
en2 | dvdg6566 | 2020-11-08 12:27:48 | 1145 | |||
en1 | dvdg6566 | 2020-11-08 12:19:30 | 696 | Initial revision (saved to drafts) |
Name |
---|