1023 D — Array Restoration

Правка en1, от SevenDeadlySins, 2018-09-07 20:00:35

I would like to know if we can solve 1023D - Восстановление массива 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!!!

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en2 Английский SevenDeadlySins 2018-09-07 20:07:00 15 (published)
en1 Английский SevenDeadlySins 2018-09-07 20:00:35 937 Initial revision (saved to drafts)