Hi All,
This is the solution that I come up with for the Parenting Partnering task.
no_of_tests = int(input())
for i in range(no_of_tests):
schedule = ''
c_busy = [0] * 1441
j_busy = [0] * 1441
n_tasks = int(input())
tasks = []
for count in range(n_tasks):
tasks.append(input())
for count in range(n_tasks):
start, end = tasks[count].split(' ')
start = int(start)
end = int(end)
c_sum = sum(c_busy[start:end + 1])
j_sum = sum(j_busy[start:end + 1])
if c_sum == 0 or c_sum - c_busy[start] == 0 or c_sum - c_busy[end+1]
== 0:
schedule += 'C'
for j in range(start, end + 1):
c_busy[j] += 1
elif j_sum == 0 or j_sum - j_busy[start] == 0 or j_sum - j_busy[end+
1] == 0:
schedule += 'J'
for j in range(start, end + 1):
j_busy[j] += 1
else:
schedule = 'IMPOSSIBLE'
break
print('Case #{}: {}'.format(i + 1, schedule))
My code works for the mentioned 4 samples. But I get RE for 1st Test set.
Can someone help me to figure out the issue?
--
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/c6701d44-0411-429d-b3c1-491051dc6e0f%40googlegroups.com.