Addition operation slower than STL::max() in C++ ?

Правка en1, от sixth_mancity_fan, 2024-06-07 12:08:18

I was doing the problem Bandit in a city. My submission used binary search to find the answer and check it. The problem arises for cases with answer 0 the code gave TLE on test 7. On using max() instead of + thiscode passed in 953 ms. I had to check for the corner case because the initial binary search code also gave TLE on test 7. I could not find anything to explain these. Is addition on long long integers slower than using max.

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en2 Английский sixth_mancity_fan 2024-06-07 12:09:34 1 Tiny change: ' of + this[code](htt' -> ' of + this [code](htt'
en1 Английский sixth_mancity_fan 2024-06-07 12:08:18 729 Initial revision (published)