Rezultati

Up. imeNalogaJezikRezultatČas oddaje
gosenice-2019 Moderna umetnost Python 3 100/100OK 09. maj '19 @ 18:46

Test Točke Porabljen spomin Porabljen čas Status
#1 [več] 20/20 8,520 MiB 0,000 s OK
#2 [več] 20/20 8,660 MiB 0,000 s OK
#3 [več] 20/20 8,727 MiB 0,000 s OK
#4 [več] 20/20 8,680 MiB 0,000 s OK
#5 [več] 20/20 8,578 MiB 0,000 s OK

Ocenjevani program (moderna.py):
w, h, n = map(int, input().split())
koordinate = [[0 for _ in range(w)] for _ in range(h)]


def pobarvaj(x1, y1, x2, y2):
    for i in range(min(x1, x2), max(x1, x2)+1):
        for j in range(min(y1,y2), max(y1,y2)+1):
            koordinate[j][i] += 1

m = n
for i in range(n):
    x1, y1, x2, y2 = map(int, input().split())
    x1 = x1-1
    x2 -= 1
    y1 -= 1
    y2 -= 1
    if (x1<0 and x2<0) or (x1>=w and x2>=w ) or (y1<0 and y2<0) or (y1>=h and y2>=h ):
        m = m-1
    else :
        if x1 < x2:
            x1 = max(x1,0)
            x2 = min(x2,w-1)
        else:
            x1 = min(x1,w-1)
            x2 = max(x2, 0)
        if y1 < y2:
            y1 = max(y1,0)
            y2 = min(y2,h-1)
        else:
            y1 = min(y1,h-1)
            y2 = max(y2,0)
        pobarvaj(x1, y1, x2, y2)

prva_vrstica = '+'
for _ in range(w):
    prva_vrstica += '-'
prva_vrstica += '+'

print(prva_vrstica)

znaki = [' ', '.', ':', '-', '=', '+', '*', '$', '#', '%']

for j in range(h):
    vrstica = '|'
    for i in range(w):
        if koordinate[j][i] > 9:
            vrstica += '@'
        else:
            vrstica += znaki[koordinate[j][i]]
    vrstica += '|'
    print(vrstica)


print(prva_vrstica)
print('{} pravokotnikov na belem'.format(m))