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

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

For the problem 1822G1 - Магические тройки (простая версия), I submitted this code 261212704 that return TLE. The complexity of this is O(n * sqrt( Max)) which leads to 10^8 operations, so that code must passed when using c++ with basic operations.

After looked at the editorial, it's the same logic with same complexity, and after submitted the editorial code 261212704, I got accepted. Can someone find what's wrong? Thanks in advance

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

»
6 месяцев назад, # |
  Проголосовать: нравится +9 Проголосовать: не нравится

You create a vector of size 1e6 every test case. Since the number of the test cases may be up to 1e4, your code leads to TLE.