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 | 3985 |
2 | jiangly | 3814 |
3 | jqdai0815 | 3682 |
4 | Benq | 3529 |
5 | orzdevinwang | 3526 |
6 | ksun48 | 3517 |
7 | Radewoosh | 3410 |
8 | hos.lyric | 3399 |
9 | ecnerwala | 3392 |
9 | Um_nik | 3392 |
# | User | Contrib. |
---|---|---|
1 | cry | 169 |
2 | maomao90 | 162 |
2 | Um_nik | 162 |
4 | atcoder_official | 161 |
5 | djm03178 | 158 |
6 | -is-this-fft- | 157 |
7 | adamant | 155 |
8 | awoo | 154 |
8 | Dominater069 | 154 |
10 | luogu_official | 150 |
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 |
---|