why i am getting WA in subtask2.

https://www.codechef.com/viewsolution/27862115

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 .

https://www.codechef.com/viewsolution/27811491

There’s a bunch of discussion about WEIRDO in this thread.

WEIRDO; FAILURE; pretty harsh shortnames this time around

No need to take power it may overflow instead use log

yeah i have done it correctly. i think its something to do with log which i dont know how to do

Yeah I know I saw your code again , try with log.

calculate root L of score and then raise power .

Taking root striked me and not log .

most are suggesting use of log but root works fine too.

https://www.codechef.com/viewsolution/27832651

from line 270

using log is giving nan

what do you mean?

Log 10 u have to use

yes but nan

Link to solution??

you should check if the value is zero before using log

checked it but no luck

i mean subtask 2 fails because the involved power goes till 1e5 . and the frequency in worst case will also be L*( length of string i.e 1e5 ) therefore 1e5*1e5 = 1e10 .

so by brute approach u calculate ( 1e10 ) ^ 1e5 . which is large and it eventually lands to 0 ( because it is in denominator .

to avoid this , i calculated root L of score ( root L because max power can be N or M which are both less than L ) i.e ( xa * (fb^m)/ xb * (fa ^ n ))^(1/L) . this will lie within bounds of long double .

later if this value is > 1 , i multiply it L times to regenerate ans . and at each point check if it exceeds 1e7 , simply break else not .

here is the link : https://www.codechef.com/viewsolution/27832651

Actually its divided into two halves one for subtask 1 and other for subtask 2 , because my root approch gave AC for subtask 2 but TLE for subtask 1 ( LOL ) . so i just used my previous code .

starts from line 210

ok i will try thanks bro