CHEFSHIP (CodeChef Bug)

I was submitting the solution for this problem in the contest multiple times and was getting TLE everytime.
so I saw some solutions already submitted after thye contest and saw that my approach was same .
I figured something was wrong but not with my code .
so I copied and pasted the already submitted correct solution of the problem and submitted it with my account on the IDE and i was surprized to see the result.
It was TLE again.(for the already accepted solution).

TLE submission : CodeChef: Practical coding for everyone
Accepted submission (of random user) : CodeChef: Practical coding for everyone

Because of this bug was getting TLE in the contest too inspite of correct solution.
Codechef should re-evaluate JAVA submissions. and check for the bug.
@admin
@codechef

The testcases in Practice are now harder than the ones during the contest:

1 Like

@admin even after making the test cases harder, the brute force is still working in python.
Look at this solution CodeChef: Practical coding for everyone

I wonder if this is an interesting data point for this : an example where the multiplier for Python actually ends up acting in Python’s favour?

A Python solution for this Problem will have 5 seconds to run, and if string comparision in Python is roughly as fast as it is in C or C++ (seems like a fairly reasonable hypothesis: there’ll probably be a bit of constant overhead for the comparison call, but the raw comparison of strings of characters is probably performed by something written in C), then Python users might have an advantage for this particular Problem.

Dunno though - all speculation :slight_smile:

3 Likes

Python somehow optimises that operation a lot. Here’s another question where a brute force python implementation passes.
https://www.codechef.com/viewsolution/26047046

3 Likes

but in this is also a brute force solution of string matching type of problem
https://www.codechef.com/viewsolution/33051854
this gives me TLE. But when i tried the totally same code in pypy3 it got accepted
https://www.codechef.com/viewsolution/32941558
@ssjgz @everule1

It is probably due to pypy3 being 2x faster.
But there are some cases where python 3.6 gets accepted and pypy3 gives tle, look at this for yourself : CHEFSHIP pypy3