TLE with memset()

i am not able to figure out why i got TLE with memset in http://www.codechef.com/FEB14/problems/LCPESY .

However , on replacing memset(..., 0 , 256) by for(i=0;i<256;i++) i got AC .

What is the reason ?

UPDATE: I should have used 256*4 for 256 size array . this was my mistake
.

2 Likes

Iā€™m sure, that problem is not with memset() we will see after the contest :wink:

1 Like

@ac_c0der :

There is also a problem with your syntax. It should be:

memset(array, 0, sizeof(array));
3 Likes

@garakchy : Rather than making dumb comments, go and get a life!

4 Likes

It is correct you have to specify the no of bytes.256 will only fill 64 indexes in int array.So your array is not fully initialized.

1 Like

it doesnt matter @ac_c0der, memset(array, 0, sizeof(array)); gave TLE anyway. some guys below understand that.