Global Round 10 — Problem F Solution Discussion

Revision en1, by yesnomaybe, 2020-08-17 20:27:14

Hi!

First of all, I would like to thank SecondThread, really appreciate your videos and effort. I think it really helps beginners, like me — to learn, improve, and understand the thought process of high rated coders.

Problem link : https://codeforces.net/contest/1392/problem/F Solution video link : https://www.youtube.com/watch?v=oHucq2J-3T8&t=12545s

He uses quite an ingenious trick to change the constraint of having adjacent difference >=2 to >=1, by subtracting i from each index initially, and then solving the problem (converts into something much simpler) and again adding the i back to the final array, and thus the solution. Can someone please explain why it works (as in the intuition behind it) (or different way of looking at solution perhaps)? My peanut brain is just not able to grasp it at all.

And if someone has solved it differently and can share the thought process, would really appreciate it.

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English yesnomaybe 2020-08-17 20:27:14 1010 Initial revision (published)