Hi I am having the same issue, can anyone help me?
t=int(input())
tasks=[]
output=[]
for i in range(t):
n=int(input())
for j in range(n):
tasks.append(input().split(" "))
for j in range(n):
for k in range(2):
tasks[j][k]=int(tasks[j][k])
a=lambda task:task[0]
tasks.sort(key=a,reverse= False)
D={"C":"F","J":"F"}
cEndTask=0
jEndTask=0
o=""
flag=0
for j in range(n):
if(tasks[j][0]>=cEndTask):
D["C"]="F"
if(D["C"]=="F" and cEndTask<=tasks[j][0]):
D["C"]="B"
cEndTask=tasks[j][1]
o+="C"
flag+=1
continue
if(tasks[j][0]>=jEndTask):
D["J"]="F"
if(D["C"]=="B" and jEndTask<=tasks[j][0]):
D["J"]="B"
jEndTask=tasks[j][1]
o+="J"
flag+=1
continue
tasks=[]
if(flag!=n):
o = "IMPOSSIBLE"
output.append(o)
for i in range(t):
print("Case #"+str(i+1)+": "+output[i])
--
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/google-code/6ec2f0be-0fab-44f7-97c6-aeae9ca040ee%40googlegroups.com.