guys, I have got 1 karma. please increase my karma(by liking) to 3,so that i could ask my doubts in the forum. Thanks in advance for spending your time.
Your program may be so long that it takes more time in compiling than specified in question. Continously calling big loops are example of that.So think big and make your code small.Thank you
Hey I am new to CodeChef and I am not comfortable with this time limit for execution. My all algorithms are logically correct and my program is working perfectly fine on my system but on codechef it is showing TLE error.
Program name is Chef And Keyboard(CHEFKEY):- CHEFKEY Problem - CodeChef
My solution:- https://github.com/ishaan123/CodeChef/blob/master/codechef-2.cpp
From the above answer it should be clear to everyone, that when you got time for example 1.01s when timelimit was 1 seconds it doesn’t mean your program finished in 1.01 but was killed = judge is not waiting.
I don’t know which problem you are trying to solve. Please provide problem code and a link to your solution. Don’t post code here. It’s unreadable.
Try removing cin and cout and use printf and scanf instead. This might work. Otherwise your code might have higher complexity. You need to optimize a bit
More over I have upvoted your question so that you can now ask question on your own and upvote and participate in codechef discuss and community rather that posting questions in answer column of editorials.
t=int(input())
while(t>0):
t=t-1
m,n=map(int,input().split())
if m==1:
m=2
for i in range(m,n+1):
c=0
for j in range(2,i//2+1):
if (i%j==0):
c=1
break
if(c<=0):
print(i)
print()