CSES - Datatähti 2020 alku - Results
Submission details
Task:Ruudukko
Sender:ossikoo
Submission time:2019-10-10 14:38:57 +0300
Language:CPython3
Status:READY
Result:0
Feedback
groupverdictscore
#10
Test results
testverdicttime
#10.02 sdetails
#20.02 sdetails
#30.02 sdetails
#40.02 sdetails
#50.02 sdetails
#60.02 sdetails

Code

def generate_empty_grid(n):
    grid = []
    for row in range(0, n):
        grid.insert(row, [0] * n)
    return grid

def get_int(n_col, n_offset, n):
    v = n_col + n_offset + 1
    if v > n:
        return v - n
    else:
        return v

def get_new_offset(cur_offset, n):
    new_offset = cur_offset + 1
    if new_offset > n:
        new_offset = 0
    return new_offset

def main(n):
    grid = generate_empty_grid(n)

    n_offset = 0
    for n_row, row in enumerate(grid):
        for n_col in range(0, len(row)):
            v = get_int(n_col, n_offset, n)
            row[n_col] = v
            print(v, end = ' ')
        n_offset = get_new_offset(n_offset, n)
        print("\n", end = '')

main(input())

Test details

Test 1

Verdict:

input
1

correct output

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 32, in <module>
    main(input())
  File "input/code.py", line 21, in main
    grid = generate_empty_grid(n)
  File "input/code.py", line 3, in generate_empty_grid
    for row in range(0, n):
TypeError: 'str' object cannot be interpreted as an integer

Test 2

Verdict:

input
2

correct output
1 2 
2 1 

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 32, in <module>
    main(input())
  File "input/code.py", line 21, in main
    grid = generate_empty_grid(n)
  File "input/code.py", line 3, in generate_empty_grid
    for row in range(0, n):
TypeError: 'str' object cannot be interpreted as an integer

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
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 32, in <module>
    main(input())
  File "input/code.py", line 21, in main
    grid = generate_empty_grid(n)
  File "input/code.py", line 3, in generate_empty_grid
    for row in range(0, n):
TypeError: 'str' object cannot be interpreted as an integer

Test 4

Verdict:

input
42

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

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 32, in <module>
    main(input())
  File "input/code.py", line 21, in main
    grid = generate_empty_grid(n)
  File "input/code.py", line 3, in generate_empty_grid
    for row in range(0, n):
TypeError: 'str' object cannot be interpreted as an integer

Test 5

Verdict:

input
99

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

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 32, in <module>
    main(input())
  File "input/code.py", line 21, in main
    grid = generate_empty_grid(n)
  File "input/code.py", line 3, in generate_empty_grid
    for row in range(0, n):
TypeError: 'str' object cannot be interpreted as an integer

Test 6

Verdict:

input
100

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

user output
(empty)

Error:
Traceback (most recent call last):
  File "input/code.py", line 32, in <module>
    main(input())
  File "input/code.py", line 21, in main
    grid = generate_empty_grid(n)
  File "input/code.py", line 3, in generate_empty_grid
    for row in range(0, n):
TypeError: 'str' object cannot be interpreted as an integer