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 | 3856 |
2 | jiangly | 3747 |
3 | orzdevinwang | 3706 |
4 | jqdai0815 | 3682 |
5 | ksun48 | 3591 |
6 | gamegame | 3477 |
7 | Benq | 3468 |
8 | Radewoosh | 3462 |
9 | ecnerwala | 3451 |
10 | heuristica | 3431 |
# | User | Contrib. |
---|---|---|
1 | cry | 167 |
2 | -is-this-fft- | 162 |
3 | Dominater069 | 160 |
4 | Um_nik | 158 |
5 | atcoder_official | 157 |
6 | Qingyu | 156 |
7 | adamant | 151 |
7 | djm03178 | 151 |
9 | luogu_official | 150 |
10 | awoo | 146 |
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 |
---|