MOBGAME HELP!

Hi,
I don’t know why I was getting wrong ans for brute force solution.
Question

Wrong Solution
https://www.codechef.com/viewsolution/27854880

Can somebody tell me where I went wrong.

Any help will be appreciated.
Thanks,

1 Like

As when you are mutiplying so your result will overflow as A[i] can be 1000 due to that u r getting wrong answer

I too submitted a similar solution and got w.a.
In the above solution long long is used then how will the result overflow. The product of all a(i) is <10^18 is the given constraint

Yeah exactly !!

But in problem, it is given that product of all A[i]'s will never exceed 10^18.

@rana_1234 use unsigned long long int i resubmitted and got right answer.i think constraints are violated in some test cases.

1 Like

Infact, both of my solutions , the original constraint and the one with lower constraints worked, after changing it to unsigned long long int…

Here, if anyone wants to refer : CodeChef: Practical coding for everyone

can someone explain why answer is 3 for the given testcase…
according to me its 4

why they are not considering the case of win lose…

@anon83591409 Thanks Buddy.
Any way its fault of author. they did not specify the constraints correctly.

@code_25
This is because if you will do all possible games, you will get in three sequence he can win.
For ex.
Level1 Level2
Win Win Score = 33 = 9 > 2 One Win
Win Loss Score = 3
1 = 3 > 2 One Win
Loss Win Score = 13 = 3 > 2 One Win
Loss Loss Score = 1
1 = 1 < 2 Loss

Total Number of Wins = 3

Hope you understand.

1 Like

I think they have:
WW, WL, LW

LL is an undesirable case as product is 1 in that case.

1 Like

@rana_1234 Thanks, I misunderstood the problem…

thanks for explanation…