GCJ 2020资格回合:育儿伙伴回报。我的方法可能有什么问题?

I am aware of the activities selection problem that can be seen here. Since we need to find for 2 people, i tried finding max possible jobs for Cameron and then removed all the jobs that can be done by Cameron. Then, in the remaining activities, I found the max possible jobs that can be done by Jamie. If there are still jobs left to be done, I say its impossible, else i print the person in order of the jobs.

该代码适用于示例情况,我自己尝试了其他几种情况,但无法找到给出错误答案的特殊情况。而且,GCJ表示它没有给出正确的答案。

在方法,思想,极端情况或完全不同的方法上的任何错误都将受到赞赏。

question can be found here and my code is

cases = int(input())
for tt in range(cases):
    n = int(input())
    pl1 = []
    pl2 = []
    activ = []
    cjc = []
    cjj = []
    plx2 = []
    plx1 = []

    for xx in range(n):
        p1,p2 = list(map(int,input().split()))
        pl1.append(p1)
        pl2.append(p2)
        activ.append([p1,p2])
    pl = sorted(pl2)
    p02 = pl[0]
    p01 = pl1[pl2.index(p02)]
    cjj.append([p01,p02])
    activ.remove([p01,p02])

    for p2 in pl[1:]:
        p1 = pl1[pl2.index(p2)]
        if(p1>=p02):
            cjj.append([p1,p2])
            activ.remove([p1,p2])
            p02=p2

    if(len(activ)>0):
        for i in activ:
            plx1.append(i[0])
            plx2.append(i[1])
        pll = sorted(plx2)
        p02 = pll[0]
        p01 = plx1[plx2.index(p02)]
        cjc.append([p01,p02])
        activ.remove([p01,p02])
        for p2 in pll[1:]:
            p1 = plx1[plx2.index(p2)]
            if(p1>=p02):
                cjc.append([p1,p2])
                activ.remove([p1,p2])
                p02=p2


    s = ''
    fff = False
    if(len(activ)>0):
        s = "IMPOSSIBLE"
    else:
        s = ''
        for i in range(n):
            if(fff == False):
                p1 = pl1[i]
                p2 = pl2[i]
                if([p1,p2] in cjc):
                    s+='C'
                elif([p1,p2] in cjj):
                    s+='J'
                else:
                    s = "IMPOSSIBLE"
                    fff = True

    ss = "Case #"+str(tt+1)+":"
    print(ss,s)