levi.ackerman1732's blog

By levi.ackerman1732, history, 3 years ago, In English

Question:1549D - Integers Have Friends My Solution:124753951

My implementation: get the absolute values of differences between two neighbouring cells and then implement the sparse table to get the queries faster. Now using sliding window technique find the max length of window.

Context: I have pretty much tried to implement the solution given in the editorial. Any insight is highly helpful. Thanks.

  • Vote: I like it
  • +20
  • Vote: I do not like it

| Write comment?
»
3 years ago, # |
Rev. 2   Vote: I like it +19 Vote: I do not like it

$$$j+2^{i-1}$$$ $$$(dp[i-1][j+(1$$$<<$$$(i-1))])$$$ can be greater than $$$n$$$.