C++ abs() causing TLE?

Правка en2, от iamujj15, 2022-08-27 21:37:58

In the last Educational Codeforces Round 134, I did a submission for Problem B. In this submission, I got a TLE. While this submission got Accepted.

The only difference both of these codes are having, is of the "abs()" function. When I used "abs()" (Although, it was redundant) it gave TLE, no loops nothing. And when I just removed (effectively) "abs()" in it, it got Accepted.

I'm wondering if "abs()" alone can cause this TLE, or there is something, very subtle about it, which was causing it. Please refer to the Links given above for both of my submissions and, in case you want to see it, the problem.

*Edit 1 : Apart from whatever mentioned above, this submission also has a difference of "vector<vector> grd(n, vector(m, 0));" (which again is a redundant thing as per the logic of code)

This doesn't seem to be causing any TLE, or is it?

Теги tle, c++

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en2 Английский iamujj15 2022-08-27 21:37:58 314 Tiny change: 'oblem.\n\n#Edit 1 : A' -> 'oblem.\n\n*Edit 1 : A'
en1 Английский iamujj15 2022-08-27 20:30:51 808 Initial revision (published)