I was doing yesterday's division 3 round, when I stumbled upon problem D. I coded together something that frankly shouldn't work but somehow does and didn't fail to hacks either. I was just wondering if anyone could come up with a rigourous(or non rigourous, idrc) proof of why my solution works.
my code: https://mirror.codeforces.com/contest/1921/submission/241787069
The way I got this idea was just doing some stuff on paper until I realized that the max diff for each corresponding element could only really be found at two reasonable spots.
Thanks!