You are not logged in. Please login at www.codechef.com to post your questions!

×

[closed] 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 .

asked 10 Feb '14, 19:51

ac_c0der's gravatar image

2★ac_c0der
72448
accept rate: 0%

edited 18 Feb '14, 03:11

anton_lunyov's gravatar image

6★anton_lunyov ♦
6.7k62119138

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


@ac_c0der :

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

memset(array, 0, sizeof(array));
link

answered 11 Feb '14, 02:43

bit_cracker007's gravatar image

3★bit_cracker007
5.7k266868
accept rate: 17%

edited 14 Feb '14, 10:55

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) sparshgunner124★

I'm sure, that problem is not with memset() we will see after the contest ;-)

link

answered 10 Feb '14, 23:55

betlista's gravatar image

3★betlista ♦♦
16.9k49115225
accept rate: 11%

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • 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,738
×1,917
×1,490
×7

question asked: 10 Feb '14, 19:51

question was seen: 2,048 times

last updated: 18 Feb '14, 03:11