Hi,
I was trying out Clean Up problem from Practice section, but this code I wrote is giving me an NZEC. I have no idea why.
Code:
from __future__ import division
def read_mapped(func=lambda x:x):
return map(func, raw_input().strip().split(" "))
def read_int():
return int(raw_input().strip())
def read_str():
return raw_input().strip()
def read_float():
return float(raw_input().strip())
T = read_int()
for case in xrange(T):
n, m = read_mapped(int)
lis = range(1, n+1)
jobs = read_mapped(int) if m!=0 else []
for j in jobs:
lis.remove(j)
chef = []
assistant = []
for i, index in enumerate(lis):
if i%2==0:
assistant.append(str(index))
else:
chef.append(str(index))
print "" if not assistant else " ".join(assistant)
print "" if not chef else " ".join(chef)
I’ve tried all test cases I could imagine, it works fine. Please tell me why this is giving me an NZEC.
Thanks.