CSES - Datatähti 2020 alku - Results
Submission details
Task:Ruudukko
Sender:tassu
Submission time:2019-09-30 13:45:04
Language:CPython2
Status:READY
Result:0
Feedback
groupverdictscore
#10
Test results
testverdicttime
#1ACCEPTED0.02 sdetails
#2ACCEPTED0.02 sdetails
#30.02 sdetails
#40.03 sdetails
#50.19 sdetails
#60.20 sdetails

Code

size = int(input())
list_of_lists = [([0] * size) for _ in range(size)]

list_of_lists[0][0] = 1

for i in range(size):
    list_of_lists[i][i] = 1
    list_of_lists[0][i] = i + 1
    list_of_lists[i][0] = i + 1

for i in range(1, size):
    for j in range(1, size):
        if i == j:
            continue

        used_numbers = []
        for smaller_i in range(i):
            used_numbers.append(list_of_lists[smaller_i][j])

        min_j = 100000
        for smaller_j in range(j):
            used_numbers.append(list_of_lists[i][smaller_j])

        # print(i, j, used_numbers)
        min_number = min(used_numbers)
        if min_number == 1 or min_number == 0 or min_number == 2:
            list_of_lists[i][j] = max(used_numbers) + 1
        else:
            list_of_lists[i][j] = min_number - 1

for foo in list_of_lists:
    for char in foo:
        print(char),
    print ""

Test details

Test 1

Verdict: ACCEPTED

input
1

correct output

user output

Test 2

Verdict: ACCEPTED

input
2

correct output
1 2 
2 1 

user output
1 2 
2 1 

Test 3

Verdict:

input
5

correct output
1 2 3 4 5 
2 1 4 3 6 
3 4 1 2 7 
4 3 2 1 8 
5 6 7 8 1 

user output
1 2 3 4 5 
2 1 4 5 6 
3 4 1 6 7 
4 5 6 1 8 
5 6 7 8 1 

Test 4

Verdict:

input
42

correct output
1 2 3 4 5 6 7 8 9 10 11 12 13 ...

user output
1 2 3 4 5 6 7 8 9 10 11 12 13 ...

Test 5

Verdict:

input
99

correct output
1 2 3 4 5 6 7 8 9 10 11 12 13 ...

user output
1 2 3 4 5 6 7 8 9 10 11 12 13 ...

Test 6

Verdict:

input
100

correct output
1 2 3 4 5 6 7 8 9 10 11 12 13 ...

user output
1 2 3 4 5 6 7 8 9 10 11 12 13 ...