Hi in problem B of last contest the answer is ∑(pi−ai)+max(pi−ai) now I don't get the max(pi−ai) part I know what it's but I don't know how did we derive it can someone help ?
# | User | Rating |
---|---|---|
1 | tourist | 4009 |
2 | jiangly | 3821 |
3 | Benq | 3736 |
4 | Radewoosh | 3631 |
5 | jqdai0815 | 3620 |
6 | orzdevinwang | 3529 |
7 | ecnerwala | 3446 |
8 | Um_nik | 3396 |
9 | ksun48 | 3388 |
10 | gamegame | 3386 |
# | User | Contrib. |
---|---|---|
1 | cry | 164 |
1 | maomao90 | 164 |
3 | Um_nik | 163 |
4 | atcoder_official | 161 |
5 | -is-this-fft- | 158 |
6 | awoo | 157 |
7 | adamant | 156 |
8 | TheScrasse | 154 |
8 | nor | 154 |
10 | Dominater069 | 153 |
Hi in problem B of last contest the answer is ∑(pi−ai)+max(pi−ai) now I don't get the max(pi−ai) part I know what it's but I don't know how did we derive it can someone help ?
Name |
---|
for adding 1 to the k elements you select need to add k+1 to your score right, so the number of turns of selecting k elements is basically the max element difference , so for each turn u spend 1 extra so the number of turns are max(pi-ai) so hence its max(pi-ai) extra
ok thanks, It clicked after reading the comment for several times the problem is that I did it with a completely different approach so it was hard for me to understand this
Maths