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

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

Hey there ...

Today I was solving these problem click ... and I got tle verdict on TC 5. Here's a link to my solution click.

As much as I got , time complexity of my above solution is O(nlogn) where n can be upto 10^5.

So , I am not getting why it is giving tle verdict. So any help regarding this would be appreciated.

Thanks in advance ;)

UPD ==================: Was getting TLE due to ( endl ).

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

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

I would like to suggest to reserve memory for the vector before filling it and recast output operations cout<<1<<" "<<x<<" "<<"R"<<endl; with cout << "1 " << x << " R\n";.

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

Use '\n' instead of endl. endl flushes the output and hence consumes more time. I modified your code and now it gives WA at test 5 and it is nowhere near to the TL.