memset or just a loop??

Правка en3, от aza-zil, 2019-07-15 22:54:34

Hey! In the last contest I was getting TLE on a problem, I thought my solution was not optimal, now I tried to solve it but using a loop to clear all elements of the array instead of "memset" -which I was using- and I got AC!! So which one is better ??

UPD: found that the TLE then using "memset" was because there was a mistake with the size of the array (which I don't know why I got TLE not RTE or something like that!!). But anyway, the time for the solution when using a "for" loop is like " 156 ms ", while it is " 1294 ms " when using "memset !!!

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en3 Английский aza-zil 2019-07-15 22:54:34 2 Tiny change: 'etter ??\nUPD: fou' -> 'etter ??\n\nUPD: fou'
en2 Английский aza-zil 2019-07-15 22:52:49 302
en1 Английский aza-zil 2019-07-15 22:30:11 277 Initial revision (published)