import time import sys inp=open("in19_9.txt","r") out=open("out_9_19_9.txt","w") infect=inp.readline().split(",") ans=inp.readline().split(",") n=inp.readline() t1=time.clock() n=int(n) trip=[] for i in range(0,n): trip.append(inp.readline().split(",")) virus=[infect[0]] x=0 k=0 while kint(infect[1]) and int(trip[i][2])<=int(ans[1]): if trip[i][0]==virus[k]: if trip[i][1] not in virus: virus.append(trip[i][1]) if trip[i][1]==virus[k]: if trip[i][0] not in virus: virus.append(trip[i][0]) if (ans[0] in virus): x=1 break k=k+1 if(x==1): out.write(str(ans[0])+" will get infected at time "+str(ans[1])) else: out.write(str(ans[0])+" will not get infected at time "+str(ans[1])) t2=time.clock() mem=sys.getsizeof(infect)+sys.getsizeof(trip)+sys.getsizeof(i)+sys.getsizeof(x) out.write('\nMemory Used='+str(mem)) out.write("\ntime taken="+str(t2-t1)) out.close()