When I run the below code in other platforms, for the sample input and output, it is running fine. But when I submit the above code in the competition, it is showing me *RUNTIME Error*. Can someone help me with why I'm facing this problem?
t = int(input()) for _ in range(t): n = int(input()) #n is basically size s1 = '' #s1 is the output string flag = 1 #flag pointer is to check whether it is impossible or not. J, C = [],[] # J and C are lists for activities performed by Jamie and Cameron for i in range(n): s,e = map(int, input().strip().split()) #s,e are start and end timings of new activity j_inc , c_inc = 0, 0 if(J==[]): #this is for first activity which we can directly assign to J J.extend([s,e]) s1+='J' elif(C==[]): #this is for second activity which we can directly assign to C C.extend([s,e]) s1+='C' else: # for all other cases j=0 # in these cases, J,C are in the form of [sm,em,sk,ek,sl,el.........] where m,k,l are natural numbers c=0 while(j<len(J)//2): #loop works till new activity is not messing with other activities in J if((s>=J[2*j+1] and e>=J[2*j+1]) or (s<=J[2*j] and e<=J[2*j])): j_inc+=1 else: while(c<len(C)//2): #loop works till new activity is not messing with other activities in C if((s>=C[2*c+1] and e>=C[2*c+1]) or (s<=C[2*c] and e<=C[2*c])): c_inc+=1 else: #if it messes with both, it should break from loop and flag is set to 0 flag = 0 break; c+=1 j+=1 if(flag==0): #to break from J loop if it already broke from C loop break if(flag==0): s1 = 'IMPOSSIBLE' break elif(j_inc==len(J)//2): #if all activities in J are checked and if new activity still doesn't mess J.extend([s,e]) s1+='J' elif(c_inc==len(C)//2): #if all activities in C are checked and if new activity still doesn't mess C.extend([s,e]) s1+='C' print("Case #"+str(i+1)+": "+s1) -- You received this message because you are subscribed to the Google Groups "Google Code Jam" group. To unsubscribe from this group and stop receiving emails from it, send an email to google-code+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/google-code/a8e862e7-a070-4265-968e-505887d1bf49%40googlegroups.com.