The greedy approach you're using doesn't handle all cases, eg

0 1
5 6
0 2
1 6


On Fri, 10 Apr 2020, 16:55 rajeswara reddy, <rajeswar972...@gmail.com>
wrote:

>
> Can anyone find what's wrong in my program for parenting partners returns
> problem
>
> z=int(input())
> for zz in range(1,z+1):
>     n=int(input())
>     l=[]
>     out='C'
>     for i in range(n):
>         t=list(map(int,input().split()))
>         l.append(t)
>     c=set(range(l[0][0],l[0][1]))
>     j=set()
>     for i in l[1:]:
>         t=set(range(i[0],i[1]))
>         if len(c.intersection(t))==0:
>             out+='C'
>             c.update(t)
>         elif len(j.intersection(t))==0:
>             out+='J'
>             j.update(t)
>         else:
>             out="IMPOSSIBLE"
>             break
>     print("Case #{}: {}".format(zz,out))
>
>
>
>
>
> --
> 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/6a674140-a6c6-4074-8508-161566cea344%40googlegroups.com
> <https://groups.google.com/d/msgid/google-code/6a674140-a6c6-4074-8508-161566cea344%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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/CAE-ZSdL8C%2B0L-RrRSEUWWv5y%3DhQzosBNqvedrb0XqTK_CiBAxA%40mail.gmail.com.

Reply via email to