How to handle the CONSTRAINTS in Codechef??
I am solving RRSTONE problem, everything looks fine from my side like logic and all. but it is saying WA. DO we programmers need to take care that the numbers never cross those boundaries by if- conditions (or inserting Assert) Or these contraints are just to give us hint for the datatype to be used??
Please guide me… I am not very familiar to code chef… :frowning: :frowning:

i am also here for IIITD but each time wrong answers.irritating…my first day here in codechef. WA becoz of logic or what i dont understand.at least they should provide some test cases which are public and which is [passed and which is not so that we could correct ourselves.but no hint even to correct it.

Hi you don’t need to check constraints, tester is doing it during the testing…

If you want to be sure, you can use assert statement, for example when reading N:

int N;
scanf( "%d", &N );
assert( 0 <= N && N <= 1000 );

if the expression in assert is evaluated as false, you will get RE with the reason of SIGABRT.


even my solution is getting WA…The solution works perfectly on my system but the shit designed by codechef evaluates it as wrong…Same is the case with 90% of the solutions I submit…I am thinking of leaving CodeChef for ever and switching over to Codeforces which provides us the test case for which our solution fails…Pardon me but I can’t resist myself saying WTF is Codechef… :frowning:


Can somebody provide some test case?

CodeForces (and any other contest programming site) is not providing test cases during the contest, don’t lie!


NO, during live contest!!!


If your code is correct, you will get AC it’s as simple as that…

1 Like

Why dont you generate few test cases yourself, using a pen and paper.


So called Shit and WTF by you, evaluates your code to W.A because it must be a Wrong answer !! Lyrically, Solved 9 problems. Hence the test cases and problems are perfectly ok, Its you who has a understanding problem.

1 Like

@miiitd_7564758 and all other complaining guys, I am also new at codechef ,but never cried like all this (Great Coders) who demand for test cases?(are u kidding me,how can u ? ).I got more than 20 times wrong answer in this problem but instead of crying I used that time to focus on what question wants? and finally i made it!!
So don’t cry !! try to read problem carefully !! read its constraints carefully !!

Happy Coding!!
it has just began !


We should take inspiration from cyberhex(hats off to his efforts).Instead of wasting time for demanding (help) for test cases try to focus on Question Read it carefully !!

1 Like

1700 contestants solved the problem, so it’s not so difficult…


You should try to solve other’s problem rather than praising yourself. What kind of great coders praise themselves? I doubt even if you tried to understand her problem. Instead you just tried to find a perfect place to tell people how you kept trying and finally succeeded.

What bull shit, how can 10^9 not be accepted in a long int data type

read the editorial - http://discuss.codechef.com/questions/42550/rrstone-editorial I linked the example there - http://ideone.com/HeY1vh