As i use python how to include constraints in it,as my code fails due to them

what do you mean by “include” constrains?
Your code may fail if it exceeds the given memory/time limit.

constraints are the input ranges against which you code will be check , so you don’t to put any if conditions for them ( this is what i have done in my first code. :XD). just write your assuming that any of the no. from the constraints can be taken as input.
i will suggest you to go through this article ones -

In Python, value of an integer is not restricted by the number of bits and can expand to the limit of the available memory

just use c++, everything will be better… :grin:

You are probably not using an optimized algorithm… This is causing overflow or TLE. I cant tell for sure unless you show the code.

those constraints states that the input that codechef will give to test ur code will follow those constraints
eg sub task 1:- 1<N<1000
sub task 2:- 1<N<1000000

and ur prog does not work(or exceeds time limit) for big num then u wont get pts for subtask2
but u get pts for sub task1

Edit:- since u didn’t specify any particular prob, am assuming this one frm ur recent submissions
here u r getting WA (Wrong Answer) its not always due to constraints. Your code might be failing on some edge cases

1 Like