Rezultati

Up. imeNalogaJezikRezultatČas oddaje
TDT-2018 Presek Python 3 100/100OK 04. okt '18 @ 18:19

Test Točke Porabljen spomin Porabljen čas Status
#1 100/100 8,680 MiB 0,000 s OK

Ocenjevani program (presek.py):
from math import sqrt, pow

N = int(input())

for i in range(N):
    s = input()
    b = list(map(int, s.split(" ")))
    r = b[6]

    x1 = b[0]
    y1 = b[1]
    x2 = b[2]
    y2 = b[3]

    xk = b[4]
    yk = b[5]


    z = "Presek je prazen"

    if x1 <= xk <= x2 and y1 <= yk <= y2:
        tocka = (xk, yk)
        print(str(tocka[0]) + ' ' + str(tocka[1]))
        continue



    if x2 <= xk <= x2 + r and y1 <= yk <= y2:
        tocka = (x2, yk)
        print(str(tocka[0]) + ' ' + str(tocka[1]))
        continue

    if x1 <= xk <= x2 and y1 - r <= yk <= y1:
        tocka = (xk, y1)
        print(str(tocka[0]) + ' ' + str(tocka[1]))
        continue


    if x1 - r <= xk <= x1 and y1 <= yk <= y2:
        tocka = (x1, yk)
        print(str(tocka[0]) + ' ' + str(tocka[1]))
        continue


    if x1 <= xk <= x2 and y2 <= yk <= y2 + r:
        tocka = (xk, y2)
        print(str(tocka[0]) + ' ' + str(tocka[1]))
        continue




    if xk > x2 and yk > y2:
        if sqrt( ( xk - x2 )**2 + ( yk - y2 )**2) > r:
            print(z)
            continue
        else:
            tocka = (x2, y2)
            print(str(tocka[0]) + ' ' + str(tocka[1]))
            continue

    if xk > x2 and yk < y1:
        if sqrt( ( xk - x2 )**2 + ( yk - y1 )**2) > r:
            print(z)
            continue
        else:
            tocka = (x2, y1)
            print(str(tocka[0]) + ' ' + str(tocka[1]))
            continue


    if xk < x1 and yk < y1:
        if sqrt( ( xk - x1 )**2 + ( yk - y1 )**2) > r:
            print(z)
            continue
        else:
            tocka = (x1, y1)
            print(str(tocka[0]) + ' ' + str(tocka[1]))
            continue

    if xk < x1 and yk > y2:
        if sqrt( ( xk - x1 )**2 + ( yk - y2 )**2) > r:
            print(z)
            continue
        else:
            tocka = (x1, y2)
            print(str(tocka[0]) + ' ' + str(tocka[1]))
            continue

    print(z)