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

Автор janardan_sharma, история, 2 года назад, По-английски

Could anyone please help me Why my code is giving TLE for problem E of Educational Codeforces Round 118.

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

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

change grid[i][j] != '#' to grid[i][j] == '.' also dont use endl , use "\n" instead Your code Accepted

  • »
    »
    2 года назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    Thank you so much man, but can you tell me how changing grid[i][j] != '#' to grid[i][j] == '.'. is decreasing the required time.

    • »
      »
      »
      2 года назад, # ^ |
        Проголосовать: нравится +1 Проголосовать: не нравится

      Changing that line of code is not decreasing the execution time, what actually is decreasing the time is the use of '\n' instead of endl.

      endl is very slow and is not suggested to be used in CP, unless you are doing an interactive problem.

      Read more here