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...
plz help...or suggest smthng i shud keep in mind further...
thanx
That's because you are using
long long
forcount
, butlong
formemo
, when you declarememo
aslong long
you will got AC ;-)yeahh...
after a few hours of posting ths blog i figured it out...
and it was btr to type cast the
memo[pre[i]]
tolong long
prior 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....:(