[CodeChef: Practical coding for everyone]
Can anyone tell me why Iam Getting WA
You posted an incorrect link.
Provide a link to your submission.
Its an incorrect link. Go to “My Submissions” and then post the link to your submission.
According to your latest solution, this is the test case which it fails on:
1
5
1010100101
10
6
The first character is 1, therefore team A scored
Score = 1(1) - 0(0)
The number in bracket shows the number of shots taken by the team
The second character is 0, therefore team B missed
Score = 1(1) - 0(1)
The third character is 1, therefore team A scored
Score = 2(2) - 0(1)
The fourth character is 0, therefore team B missed
Score = 2(2) - 0(2)
The fifth character is 1 therefore team A scored
Score = 3(3) - 0(2)
The sixth character is 0 therefore team B missed
Score = 3(3) - 0(3)
Now you see, Team A has taken an unassailable lead. Team B has only 2 shots left, but 3 goals to score, which is not possible. Hence the correct answer is 6.
Can you explain briefly what was your though process/logic to solve the problem?
However, the problem is simple all you need to do is simulate a penalty-shootout taken in a football match.
It was that anyone team should loose atleast two shots and other score (n-1) shoots.
Can anyone please help me by telling what is wrong with this?
https://www.codechef.com/viewsolution/35920719