×

# [closed] TLE with memset()

 1 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 . asked 10 Feb '14, 19:51 2★ac_c0der 72●4●4●8 accept rate: 0% 6.7k●62●119●138 it doesnt matter @ac_c0der, memset(array, 0, sizeof(array)); gave TLE anyway. some guys below understand that. (16 Feb '14, 01:40) garakchy1★

### The question has been closed for the following reason "Problem is not reproducible or outdated" by bit_cracker007 16 Feb '14, 03:12

 3 There is also a problem with your syntax. It should be: memset(array, 0, sizeof(array));  answered 11 Feb '14, 02:43 5.7k●26●68●68 accept rate: 17% 4 @garakchy : Rather than making dumb comments, go and get a life! (13 Feb '14, 10:15) sumit1722★ 1 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. (13 Feb '14, 22:12)
 1 I'm sure, that problem is not with memset() we will see after the contest ;-) answered 10 Feb '14, 23:55 16.9k●49●115●225 accept rate: 11%

By Email:

Markdown Basics

• *italic* or _italic_
• **bold** or __bold__
• image?![alt text](/path/img.jpg "title")
• numbered list: 1. Foo 2. Bar
• to add a line break simply add two spaces to where you would like the new line to be.
• basic HTML tags are also supported
• mathemetical formulas in Latex between \$ symbol

Question tags:

×2,698
×1,901
×1,470
×7

question asked: 10 Feb '14, 19:51

question was seen: 2,033 times

last updated: 18 Feb '14, 03:11