Rezultati

Up. imeNalogaJezikRezultatČas oddaje
schrutefarms-2018 Prehitevanje Python 3 0/100Napaka med izvajanjem / ob izhodu (RTE) 04. okt '18 @ 19:05

Test Točke Porabljen spomin Porabljen čas Status
#1 0/16 8,523 MiB 0,000 s Program je končal z neničelno kodo
Stderr:
Traceback (most recent call last):
  File "source.py3", line 41, in <module>
    while d[pari][1] != '':
KeyError: ''
#2 0/16 8,645 MiB 0,000 s Program je končal z neničelno kodo
Stderr:
Traceback (most recent call last):
  File "source.py3", line 41, in <module>
    while d[pari][1] != '':
KeyError: ''
#3 17/17 8,672 MiB 0,000 s OK
#4 0/17 30,625 MiB 4,431 s Prekoračen čas
#5 17/17 90,848 MiB 2,983 s OK
#6 17/17 8,523 MiB 0,000 s OK

Ocenjevani program (lisiii.py):
import sys
f= sys.stdin

#f = open('tust.txt','r')
lines = f.read().strip().split('\n')
n = int(lines[0])
emrat = lines[1:n+1]
ndrysh = lines[n+2:]

d = dict()
for i in range(n):
    if i==0:
        d[emrat[0]]=('', emrat[1])
    elif i==n-1:
        d[emrat[n-1]]=(emrat[n-2], '')
    else:
        d[emrat[i]] = (emrat[i-1], emrat[i+1])
        
for i in ndrysh:
    l = i.split(' ')
    p1 = l[0]
    p2 = l[1]
    p1_perpara = d[p1][0]
    p1_mrapa = d[p1][1]
    p2_perpara = d[p2][0]
    p2_mrapa = d[p2][1]
    
    if p1_perpara != '':
        d[p1_perpara] = (d[p1_perpara][0], p1_mrapa)
    if p1_mrapa != '':
        d[p1_mrapa] = (p1_perpara, d[p1_mrapa][1])
    if p2_perpara != '':
        d[p2_perpara] = (d[p2_perpara][0], p1)
    d[p1] = (d[p2][0], p2)
    d[p2] = (p1, d[p2][1])
pari = ''    
for c in d:
    if d[c][0] == '':
        pari = c
        
while d[pari][1] != '':
    print(pari)
    pari = d[pari][1]
print(pari)    
    
    
    
    
f.close()