Rezultati

Up. imeNalogaJezikRezultatČas oddaje
jayzcrew-2018 Droni Python 3 100/100OK 10. maj '18 @ 19:47

Test Točke Porabljen spomin Porabljen čas Status
#1 5/5 11,352 MiB 0,000 s OK
Povratna informacija sodniškega sistema:
​The output was correct.
#2 5/5 11,336 MiB 0,000 s OK
Povratna informacija sodniškega sistema:
​The output was correct.
#3 5/5 11,387 MiB 0,000 s OK
Povratna informacija sodniškega sistema:
​The output was correct.
#4 5/5 11,379 MiB 0,000 s OK
Povratna informacija sodniškega sistema:
​The output was correct.
#5 5/5 11,348 MiB 0,000 s OK
Povratna informacija sodniškega sistema:
​The output was correct.
#6 5/5 11,324 MiB 0,000 s OK
Povratna informacija sodniškega sistema:
​The output was correct.
#7 5/5 11,332 MiB 0,000 s OK
Povratna informacija sodniškega sistema:
​The output was correct.
#8 5/5 11,328 MiB 0,000 s OK
Povratna informacija sodniškega sistema:
​The output was correct.
#9 5/5 11,363 MiB 0,000 s OK
Povratna informacija sodniškega sistema:
​The output was correct.
#10 5/5 11,402 MiB 0,000 s OK
Povratna informacija sodniškega sistema:
​The output was correct.
#11 5/5 11,324 MiB 0,000 s OK
Povratna informacija sodniškega sistema:
​The output was correct.
#12 5/5 11,285 MiB 0,000 s OK
Povratna informacija sodniškega sistema:
​The output was correct.
#13 5/5 11,273 MiB 0,000 s OK
Povratna informacija sodniškega sistema:
​The output was correct.
#14 5/5 11,355 MiB 0,000 s OK
Povratna informacija sodniškega sistema:
​The output was correct.
#15 5/5 11,297 MiB 0,000 s OK
Povratna informacija sodniškega sistema:
​The output was correct.
#16 5/5 11,289 MiB 0,000 s OK
Povratna informacija sodniškega sistema:
​The output was correct.
#17 5/5 11,332 MiB 0,000 s OK
Povratna informacija sodniškega sistema:
​The output was correct.
#18 5/5 11,289 MiB 0,000 s OK
Povratna informacija sodniškega sistema:
​The output was correct.
#19 5/5 11,328 MiB 0,000 s OK
Povratna informacija sodniškega sistema:
​The output was correct.
#20 5/5 11,289 MiB 0,000 s OK
Povratna informacija sodniškega sistema:
​The output was correct.

Ocenjevani program (droni.py):
import random


zac = list(map(int, input().strip().split()))
kon = list(map(int, input().strip().split()))

dron1 = zac[:3]
dron2 = kon[:3]
cilj1 = zac[3:]
cilj2 = kon[3:]

def move(dron, cilj):
    indeksi = []
    for i in range(3):
        if dron[i] != cilj[i]:
            indeksi.append(i)

    if len(indeksi) == 0:
        return dron
    else:
        premik = random.choice(indeksi)
        if dron[premik] < cilj[premik]:
            dron[premik] += 1
        else:
            dron[premik] -= 1
        return dron

def nakljucen(dron):
    i = random.randint(0,2)
    p = random.choice([-1,1])
    dron[i] += p
    return dron

def koord(d1):
    d2 = [str(e) for e in d1]
    return '({0} {1} {2})'.format(d2[0],d2[1],d2[2])

def natisni(d1,d2):
    print(koord(d1) + ' ' + koord(d2))

natisni(dron1,dron2)

while True:
    prvi = move(dron1[:], cilj1)
    drugi = move(dron2[:], cilj2)

    if prvi == dron1 and drugi == dron2:
        break

    crash = False

    if (prvi == drugi):
        crash = True
    if (prvi == dron2 and drugi == dron1):
        crash = True

    if not crash:
        dron1 = prvi
        dron2 = drugi
        natisni(dron1,dron2)
    else:
        prvi = nakljucen(dron1[:])
        if prvi != dron2:
            dron1 = prvi
            natisni(dron1,dron2)