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

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

This is the code (https://codeforces.com/contest/1746/submission/176340285) of one of the contestant in my room of global round 23. And I think it should result in TLE(Correct me if I'm assuming something wrong). As you can see he used l.pop(idx_i) inside his second while loop of his sort function and the time complexity of pop function is O(N), when it is performed on any arbitrary index.

Here is the testcase which can make his code go TLE :-

2

100000

1 1 1 ... till 50000 places + 0 0 0 ... till 100000 places

100000

1 1 1 ... till 50000 places + 0 0 0 ... till 100000 places

Полный текст и комментарии »

Теги tle
  • Проголосовать: нравится
  • 0
  • Проголосовать: не нравится

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

160347701 Could anybody please tell me why this code is working for below testcase :

1
100000
first String :- [aaaaaaa....till 50000 places] + [bbbbbbbb.... till 100000 places]
second String :- [bbbbbb....till 50000 places] + [aaaaaaa....till 100000 places]

According to the code and the testcase given ,the time complexity should be (N + (50000^2)) which should give TLE then why it is not giving TLE. Would anyone like to help me out.

Полный текст и комментарии »

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