Lessons learned from solving weirdo (as well as solution)

U can see my solution then
https://www.codechef.com/viewsolution/27811491

Read from line 334

2 Likes

That’s really nice, but there was a much simpler way😉

Just use naive approach, and get product of all xc,fxa,xb,fxb at one place…then use logarithm on whole expression directly

10 Likes

Okay, will check!

Can you share your solution here?

I just took root L of the score . and recursively multiplied to get answer ( with appropriate break statement ) .

Could u tell why m getting tle in substask 1
And ac in rest
I used same approach as mentioned in thread
https://www.codechef.com/viewsolution/27867163

The same happened with me .
would be great if someone helps !
To get full score i just pust if statement and copied my solution for subtask 1 :sweat_smile:

1 Like

Same here :slight_smile:

WEIRDO - “From Zero to Infinity” - documented code; Editorial-style overview

I was also toying with the whole prime factorisation approach, but thankfully - and slightly surprisingly - using logs turned out to be accurate enough :slight_smile:from-zero-to-infinity-git-log

5 Likes

Fantastic. I will study your code in detail actually. Since I was struggling in the input processing phase too. :slight_smile:
Thanks for sharing!!!

here’s mine

btw also check out @ssjgz code also, it’s pretty neat

3 Likes

Here is explaianation…

3 Likes

Heavy input processing in task 1.

I was facing same issue when I was using maps to shore character frequencies (check here): CodeChef: Practical coding for everyone

Then I changed my code to use vector and got AC.

Many people did wrong to check whether a string is of Alice or Bob , they just count vowels and conso and check if vowels are greater than equal to conso then it will be of Alice else Bob which is Wrong

Instead of this we have to count vowels and conso in each three consecutive character of string .

1 Like

I used a completely different approach.

take a look here

I was getting AC for subtask 1(1.41s) and WA for subtask 2. I changed from maps and strings to arrays and got AC for subtask 1(0.2s) and WA for subtask 2. Finally on using cpp_dec_float_50 to find the final answer I got AC for subtask 2. Have a look here

https://www.codechef.com/viewsolution/27868379
Did all the things mentioned here still don’t know what is wrong. Please anybody look at this.
Tried everything i knew boost etc.

Though i thought of the same approach but won’t there be cases where the resultant will be small but the power function overflows

Do not calculate power buddy see my solution above mentioned I did not calculate power bcz it will overflow

3 Likes

You don’t need power, just three basic log properties

log(a^b) = b*log(a)

log(a/b)= log(a) - log(b)

log(a*b)= log(a) + log(b)

Use them on the expression to get it into a one line formula which doesn’t need powers but logarithms

3 Likes