Can someone explain 1917B solution?

Revision en2, by EErbium, 2023-12-30 17:19:39

This was my solution with O(n^2) complexity which results in MLE:

https://codeforces.net/contest/1917/submission/238752759

Here is the solution with a lower complexity:

https://codeforces.net/contest/1917/submission/239038045

I did not understand what was done in the solution. Can anyone explain?

I read the editorial but can't understand that aswell.

Tags c++, explanation, need explanation, need help, solution, editorial

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English EErbium 2023-12-30 17:19:39 79 (published)
en1 English EErbium 2023-12-30 17:16:38 325 Initial revision (saved to drafts)