GIFTCHEF had wrong input files...

It was mentioned by the GIFTCHEF author @omelyanenko in the comment section on the problem page that the input string will consist of only lowercase english letters… but that was not the case… i submitted my solution https://www.codechef.com/viewsolution/12100766 assuming the same and i got WA .
Out of intuition, when i submitted the same code by stripping the strings with side whitespaces after the contest got ended, i got AC.
The accepted solution is https://www.codechef.com/viewsolution/12100864 . The only difference between the two solution is use of strip() function.
What should i expect from Codechef for such blunders?

5 Likes

I too had this same problem, and just by intuition i did strip() and got everything correct.

I submitted around 60 WA’s and in all of the subtasks, I got WA in one and AC in rest. It took me so much time, to realize that strings might not be all lowercase as mentioned.

They carried a stepney “\n” at the end.
strip() was required.

2 Likes

Yes, the author mentioned that string consists of only lowercase letters.
I also got many Wrong Answers while using python.
So,I switched to C++ and got it Accepted.
Codechef should keep a check on such blunder mistakes, it wastes time of the participants.

5 Likes

It is high time that codechef should disclose the testcases after the contest or bring out something like “hackos” points of hackerrank. It really helps.

1 Like

The author himself gave the answer on the [contest page][1].

You must not assume that line endings are unix-style '\n', they may very well be "\r\n". Java and C+±programmers are quite lucky when using formatted input because redundant white space is ignored. In python you have to take care of this yourself.

EDIT: What I’m trying to say is that this is not a blunder on the site of codechef, but it propably will happen again. Nevertheless this question obviously has its merits, because it’s easy to forget about the different forms of line endings. But the issue of this thread should be learning about this pitfall, not complaining.
[1]: https://www.codechef.com/NOV16/problems/GIFTCHEF/

6 Likes

@ceilks Sir, there is comment by the author @omelyanenko on the problem page as per which he says, “Strings consist of only lowercase English letters”. A novice might get intuition to check for the alternative cases, but author’s specific answer makes him think one way. I got many WA when i switched to C++ and knew that same logic worked in C++.

2 Likes

Going by the topic of discussion I thought the problem had wrong test cases. But for fomatting, I don’t think it is correct to blame the problem setter(heck even icpc contests have such test files). It is up to the programmer to read what is required and be familiar with nuances of the language, at least i/o.

I was referring to the answer of the author further down in the thread. You are correct that it’s pretty unfortunate for python users, but the authors first answer is also technically correct as the dangling “\r” is not part of the sring but of the representation of the line ending.

1 Like

Hey, We will have the problem setting panel look into this. They will take the necessary action.

1 Like