rohan537's blog

By rohan537, history, 4 years ago, In English

problem: 1363D - Guess The Maximums Why is my code giving idleness limit exceeded on test 8?82255684...your help will be much appreciated

  • Vote: I like it
  • -8
  • Vote: I do not like it

»
4 years ago, # |
Rev. 2   Vote: I like it 0 Vote: I do not like it

Do you consider the case where the index of the maximum number is not contained in the given sets? For example, consider array $$$a$$$ to be $$$[3, 2, 7, 3, 5]$$$ and $$$k = 2$$$ sets being {$$$1, 2$$$} and {$$$4, 5$$$}. Ans should be $$$7, 7$$$.

Edit: Ignore the above, you do.

Found your mistake, it was a really subtle one. In line 84, you have an if statement with the following condition adj[i][j]==ask. However, you never consider that j can be greater than adj[i].size(). Added that and got AC 82269561.

  • »
    »
    4 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    thank u so much bro...i looked atleast 20 tines without noticing that