Rezultati

Up. imeNalogaJezikRezultatČas oddaje
jam-2018 Kvadrat števil Python 3 100/100OK 13. okt '18 @ 11:44

Test Točke Porabljen spomin Porabljen čas Status
#1 10/10 8,668 MiB 0,000 s OK
#2 10/10 8,605 MiB 0,000 s OK
#3 10/10 8,520 MiB 0,000 s OK
#4 10/10 8,535 MiB 0,000 s OK
#5 10/10 8,836 MiB 0,000 s OK
#6 10/10 8,746 MiB 0,000 s OK
#7 10/10 9,324 MiB 0,000 s OK
#8 10/10 9,199 MiB 0,000 s OK
#9 10/10 9,258 MiB 0,000 s OK
#10 10/10 9,211 MiB 0,000 s OK

Ocenjevani program (main.py):

N = int(input())

s = []

for i in range(N*N):
    s.append(int(input()))

s.sort(reverse=True);

t = [[0 for i in range(N)] for j in range(N)]

cx = int(N / 2)
cy = int(N / 2)

t[cx][cy] = s[0]

x = cx
y = cy-1
d = 0

def prestavi():
    global x, y, d

    x += 1 if d in [1, 2] else -1
    y += 1 if d < 2 else -1

    if x == cx or y == cy:
        d += 1
        if d == 4:
            y -= 1
            d = 0



for i in range(1, N*N):

    t[x][y] = s[i]

    if i < N*N - 1:
        prestavi()
        while x < 0 or y < 0 or x >= N or y >= N:
            prestavi()

for i in range(N):
    for j in range(N):
        print(t[j][i], end=" ")
    print()

'''



3
70
72
80
75
70
999
75
69
75


'''