Turns out that it *was not* a Runtime Error. Thanks to @porker2008 I was 
able to fix my answer by first sorting the activities. Apparently "Case #3: 
CJJCC" is not a valid alternative for "Case #3: JCCJJ".

On Tuesday, 7 April 2020 02:44:08 UTC+2, eegee wrote:
>
> I keep getting a RE (Runtime Error) for my solution on "Parenting 
> Partnering Returns". It passes the test case, but fails for the submission. 
> It is quite frustrating not knowing what the issue is. I spent an 
> inordinate amount of time trying to get the first solution submitted since 
> it also had RE that turned out to be a missing import statement.
>
> My proposed solution:
>
> def no_clash(person, activity_start, activity_end):
>     for person_start, person_end in person:
>         if activity_start < person_end < activity_end:
>             return False
>         if activity_start < person_start < activity_end:
>             return False
>         if activity_start <= person_start < person_end <= activity_end:
>             return False
>         if person_start <= activity_start < activity_end <= person_end:
>             return False
>     return True
>
>
> for case in range(int(input())):
>     answer = ""
>     cameron = []
>     jamie = []
>     for activity in range(int(input())):
>         start, end = map(int, input().split())
>         if no_clash(cameron, start, end):
>             cameron.append((start, end))
>             answer += "C"
>         elif no_clash(jamie, start, end):
>             jamie.append((start, end))
>             answer += "J"
>         else:
>             answer = "IMPOSSIBLE"
>             break
>
>     print("Case #{}: {}".format(case + 1, answer))
>
>
> Test input:
>
> 4
> 3
> 360 480
> 420 540
> 600 660
> 3
> 0 1440
> 1 3
> 2 4
> 5
> 99 150
> 1 100
> 100 301
> 2 5
> 150 250
> 2
> 0 720
> 720 1440
>
>

-- 
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/5b4211a9-60f0-4cea-972b-6df2a0b41372%40googlegroups.com.

Reply via email to