What seems to be wrong in this code , its passing the visible test cases 
but am getting wrong answer when i subimit

n=int(input())
for m in range(n):
    no=int(input())
    inp=[]
    res=[]
    flag=1
    tempo={}
    for j in range(no):
        temp=list(map(int,input().split()))
        inp.append(temp)
    inpr=inp.copy()    
    inp.sort(key=lambda x:x[0])
    Jam=0
    Cam=0
    for i in inp:
        if i[0]>=Cam:
            tempo[inpr.index(i)]='C'
            Cam=i[1]
        elif i[0]>=Jam:
            tempo[inpr.index(i)]='J'
            Jam=i[1]
        else:
            res=list('IMPOSSIBLE')
            flag=0
    if flag==1:        
        for key in sorted(tempo.keys()):
            res.append(tempo[key])
    ans=''.join(res)        
    print('Case #{}: {}'.format(m+1,ans))




-- 
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/4f347b71-c8b7-43e6-b9da-1e25df8d404a%40googlegroups.com.

Reply via email to