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
Same here
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
Fantastic. I will study your code in detail actually. Since I was struggling in the input processing phase too.
Thanks for sharing!!!
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 .
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
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
Fantastic. I studied it in detail. From a debug perspective, can you explain the purpose of assert(cin) in the last line?
It’s just to ensure that I haven’t accidentally tried to read more input than exists, or e.g. tried to read a string as an int
or somesuch - something that has bitten me a few times in the past
Edit:
Also helps to make sure that my testcase generator generates the right amount of stuff and of the right type.
Thanks for the explanation! Would you mind if I mimic some elements of your style, since emulation is the highest form of adulation!
I would be honoured Please take anything you want
Edit:
I gabbled on about my process here, and included the code template I usually use. Bear in mind that I don’t do short contests, though - the process really wouldn’t be suitable for those
Fantastic. Good practices to be learnt!