I will explain the algorithm step wise if someone wants to know the same
and at the same tome tell about the edge cases one can miss. Following is
the logic
1. Sort the input in ascending order of start times
2. Assign (0,0) as the end time of jobs allocated to Cameron and Jamie.
They are o
This is the final code which clears all test cases.
T = int(input())
for i in range(1,T+1):
N=int(input())
jobs=[]
for x in range(N):
jobs.append(tuple(map(int, input().split(' ')))+(x,))
L = [0]*N
cj=[0,0]
m = sorted(jobs)
imp = False
for j in m:
So I think I have found out the reason for RE. *I didn't consider fully
overlapping job intervals*. Due to this when a fully overlapping interval
is in the test set, the dictionary just updates to a new value with the key
remaining same. In this case first (1,10) points to the value 0 then it
The following code works fine on my local machine as well the code jam
editor. However, as soon as I submit it gives me run time error. Any idea
whats going wrong?? Before that a few important points - the reason I am
not using .values() is because Python dictionaries may randomly
change the