Rezultati

Up. imeNalogaJezikRezultatČas oddaje
schrutefarms-2018 Presek Python 3 0/100Napačen odgovor (WA) 04. okt '18 @ 16:36

Test Točke Porabljen spomin Porabljen čas Status
#1 0/100 8,602 MiB 0,000 s Napačen odgovor

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

#f = open('test.txt','r')
lines = f.read().strip().split('\n')
lines = lines[1:]

def pikat(q1, q2, r):
    return [[q1-r,q2], [q1, q2+r], [q1+r,q2], [q1, q2-r]]

def mrena(x1, y1, x2, y2, p1, p2):
    if p1>=x1 and p1<=x2 and p2>=y1 and p2<=y2:
        return True
    else:
        return False
    

for line in lines:
    infos = line.split(" ")
    x1, y1, x2, y2 = int(infos[0]), int(infos[1]), int(infos[2]), int(infos[3])
    q1, q2, r = int(infos[4]), int(infos[5]), int(infos[6])
    l = pikat(q1,q2,r)
    lis = []
    for pika in l:
        lis.append(mrena(x1,y1,x2,y2,pika[0],pika[1]))
    intersection = False    
    for i in range(len(lis)):
        if lis[i]:
            print(str(l[i][0])+" "+str(l[i][1]))
            intersection = True
            break
    if not intersection:
        print("Presek je prazen")
                    
    
f.close()