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/a9b53a4a-155f-468a-8326-6eb4dfde8df8%40googlegroups.com.