Блог пользователя rohan537

Автор rohan537, история, 6 лет назад, По-английски

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

  • Проголосовать: нравится
  • -8
  • Проголосовать: не нравится

»
6 лет назад, скрыть # |
← Rev. 2  
Проголосовать: нравится 0 Проголосовать: не нравится

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.