Rezultati

Up. imeNalogaJezikRezultatČas oddaje
vlakectomaz-2018 Zaletavanje Python 3 100/100OK 19. apr '18 @ 20:06

Test Točke Porabljen spomin Porabljen čas Status
#1 14/14 8,496 MiB 0,000 s OK
#2 14/14 8,574 MiB 0,000 s OK
#3 14/14 8,664 MiB 0,000 s OK
#4 14/14 8,684 MiB 0,000 s OK
#5 14/14 8,539 MiB 0,000 s OK
#6 15/15 8,613 MiB 0,000 s OK
#7 15/15 8,672 MiB 0,000 s OK

Ocenjevani program (zaletavanje.py):
N, W, H = [int(x) for x in input().split(" ")]
avti = []
avti_i = list(range(N))
for i in range(N):
	s,x,y = input().split(" ")
	avti.append((s,int(x),int(y)))
	
trki = []

avti_en = list(enumerate(avti))
for i1,a1 in avti_en:
	for i2,a2 in avti_en[i1+1:]:
		s1,x1,y1 = a1
		s2,x2,y2 = a2
		if(s1 != s2 and (x1-x2) == -(y1-y2)):
			cas = abs(x1-x2)
			if(y1>y2 and s1=="D" or
				 y1<y2 and s1=="G"):
				trki.append((cas,i1,i2))

trki.sort()
#print(trki)

for c,i1,i2 in trki:
	avti_i[i1],avti_i[i2] = avti_i[i2],avti_i[i1]
	#print(avti_i)
	
avti_i = sorted(zip(avti_i, range(len(avti_i))))	
avti_k = [avti[i] for _, i in avti_i]
for s,x,y in avti_k:
	if(s=="G"):
		print("%d %d" % (x, H))
	else:
		print("%d %d" % (W, y))