I think time limit is too strict for some languages.For example My Python code takes 10.249 secs to solve 1000 testcases with k = 100 and ni = 45 and nos in range(2147483648). My algorithm is *correct as i have taken help from editorial. Same algorithm in C gets AC while in Python it gets TLE. Time Limit should be relaxed for some languages.
In fact best C++ solution if coded to Python takes about 11 secs.
And just reading the input and sorting the arrays take about 6 secs.
This is my solution after reading the editorial.Someone please point out where I am going wrong.This is giving correct answer for the sample cases.I can’t think of cases to determine the error.
all those who are not able to understand this may refer to this link:Hackenbush - general - CodeChef Discuss. this question has been asked by me at this link
In the editorial in the case 3,pile having the value {2,3},we are considering that if the chef is busy considering the other stalks, than {2 ,3} stalk will give more turns to the apponent and thus the value of the {2 ,3} stalk would be less than +v,but if the chef choses the stalk than the apponent will have not have extra turns which were provided by the stalk,so in that case will the value of the stalk will be equal to +v??
you are right…duplicate values are irrelevant. Even I am surprised you got AC for the first approach. The first approach has to be wrong. Compare your answers on this test case: 1 2 5 4 4 9 11 16 2 9 10
The first one will give “even” but the second will give “odd”. And obviously the correct answer is odd.
Correct answer to this case should actually be DON’T PLAY. We have two piles {3,3,3} and {2,4}. If you take ODD then the opponent will select 2 from second pile and you will lose. If you take EVEN and chose 2 then opponent will chose 3 from first pile and you will be left with nothing.
The answer should be “don’t play” as if the player chooses odd he will have to remove all ones and then the opponent will win by removing 2 from the other pile. If the player chooses even then he will have to remove 2 and the opponent will win by removing all ones from the other pile.
Looks like the condition that pile contains only unique numbers got missed. I can see assert in Setter’s code that numbers are unique. I will let setter comment on this.
@shaleen if the test cases are wrong or if their is any missing assertion with the problem statement than it’s purely not the participant’s problem. I was thinking that i was wrong, even I created more than 400 test cases of my own, but as we all have noticed a large group of submission are giving WA on very simple test cases. All the solutions must be rejudged.
I don’t think the solutions can be rejudged now because many of the users whose solutions are failing would have been able to correct their code if their solutions were judged WA. This is the problem setter’s mistake and nothing can be done about this now. This is actually a grave issue as it seems there is one problem in every month’s contest which has some missing test cases(remember KAMEHAMEHA).