1023 D — Array Restoration

Revision en1, by SevenDeadlySins, 2018-09-07 20:00:35

I would like to know if we can solve 1023D - Array Restoration like this....

change any zero to a non zero value just to its left (or right, doesn't matter), check for occurrence of value "q" in the array, keep track of li and ri as index of first and last appearance of i in array for all possible i given in array and then for every "i" check if there is a value less than i (let that be j) in the array in index range [li, ri] . If such a value exists then we can say that such an array cant occur because query with j < i will always happen after jth query so there can be complete overlap or partial of ith query over jth query and not vice-versa....

I think this a sufficient condition for the solution but i m not able to get ans.... (solution link : 42340677)

I would to like to know for some flaw in the solution or counter example for the same (explaining the flaw)

Thanks in advance!!!

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English SevenDeadlySins 2018-09-07 20:07:00 15 (published)
en1 English SevenDeadlySins 2018-09-07 20:00:35 937 Initial revision (saved to drafts)