Rezultati

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

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

Ocenjevani program (presek.py):
n = int(input())
for _ in range(n):
    x1,y1,x2,y2,xk,yk,r = map(int, input().split())
    izpis = False
    ogljisca = [(x1,y1), (x2,y2), (x2,y1), (x1,y2), ((x1 + x2) / 2, y1), ((x1 + x2) / 2, y2), (x1, (y1+y2) / 2), (x2, (y1+y2) / 2)]

    stranice = [(x1,y1,x1,y2), (x2,y1,x2,y2),(x1,y2,x2,y2), (x1,y1,x2,y1)]
    for x,y in ogljisca:
        a = abs(x - xk) * abs(x - xk)
        b = abs(y - yk) * abs(y - yk)
        #print (x,y, a, b)
        if (r*r >=  a + b ):
            print (x,y)
            izpis = True
            break
    
    if (not izpis):
        for sx1,sy1,sx2,sy2 in stranice:
            if (yk <= sy2 and yk >= sy1 and r >= abs(sx1 - xk)):
                print (sx1, yk)
                izpis = True
                break
            if (yk <= sy2 and yk >= sy1 and r >= abs(sx2 - xk)):
                print (sx2, yk)
                izpis = True
                break

            if (xk <= sx2 and xk >= sx1 and r >= abs(sy1 - yk)):
                print (xk, sy1)
                izpis = True
                break
            if (xk <= sx2 and xk >= sx1 and r >= abs(sy2 - yk)):
                print (xk, sy2)
                izpis = True
                break


    if (not izpis and  xk <= x2 and xk >= x1 and yk <= y2 and yk >= y1):
        print (xk, yk)
        izpis = True


    if (not izpis):
        print("Presek je prazen")
    #print(x1,y1,x2,y2,xk,yk,r)