sentinel45's blog

By sentinel45, 12 years ago, In English

getting WA constantlyy.....

165C - Another Problem on Strings

i've now tried every way to get the correct answer to ths prob...

initialy ws getting TLE thn i optimized my code...

pre is the vector holding number of 1's encountered till i...

memo is counting the ferquency of ths number of 1's...

my code is here...

1824256

plz help...or suggest smthng i shud keep in mind further...

thanx

  • Vote: I like it
  • -26
  • Vote: I do not like it

»
12 years ago, # |
  Vote: I like it 0 Vote: I do not like it

That's because you are using long long for count, but long for memo, when you declare memo as long long you will got AC ;-)

  • »
    »
    12 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    yeahh...

    after a few hours of posting ths blog i figured it out...

    and it was btr to type cast the memo[pre[i]] to long longprior to multiplication...than changing the declaration to long long.. (i tried both ways...:P)

    but seeing no reactions...i didnt update the blog...

    thnx fr yr response....though, i cannot understand y i got so mny downvotes....:(