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

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

Hi guys, I am trying to solve segment tree question on cses . my Python solution passes only 1 test case and gives me TLE, but c++ solution get accepted, i tried to look online optimize python solution but still no luck , if you can help me to optimize my code it would be great .

problem : https://cses.fi/problemset/task/1648

My code Link : code link

Thanks

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

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

Hi! I suggest you to keep solving problems in C++. Python is squite slower and Time Limit in CSES is quite tight. I don´t know python very much but you one thing you can try, is to find any other method to read input and print output faster. There are lots of queries and that could be the cause.

In addition, I can see that most of people solved this problem in C++, and only few people solve in Python with best execution time of 0.8 seconds.

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