Alternate solution to Codeforces Round 920 problem D?

Revision en1, by Jbi, 2024-01-17 01:12:01

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://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!

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English Jbi 2024-01-17 01:12:01 609 Initial revision (published)