| Task: | Ruudukko |
| Sender: | ossikoo |
| Submission time: | 2019-10-10 16:11:26 +0300 |
| Language: | Python3 (CPython3) |
| Status: | READY |
| Result: | 0 |
| group | verdict | score |
|---|---|---|
| #1 | WRONG ANSWER | 0 |
| test | verdict | time | |
|---|---|---|---|
| #1 | ACCEPTED | 0.02 s | details |
| #2 | ACCEPTED | 0.02 s | details |
| #3 | WRONG ANSWER | 0.02 s | details |
| #4 | WRONG ANSWER | 0.04 s | details |
| #5 | WRONG ANSWER | 0.45 s | details |
| #6 | WRONG ANSWER | 0.47 s | details |
Code
def generate_empty_grid(n):
grid = []
for row in range(0, n):
grid.insert(row, [0] * n)
return grid
def get_lowest_int(grid, n_row, n_col):
if n_col == 0 and n_row == 0: return 1
row_vals = n_col > 0 and grid[n_row][0:n_col] or []
col_vals = []
for n_upper_row in range(0, n_row):
col_vals.append(grid[n_upper_row][n_col])
taken_vals = row_vals + col_vals
# find lowest missing integer in range 1 to len(grid)
for val in range(0, len(grid)):
val += 1
if not val in taken_vals:
return val
def main(n):
grid = generate_empty_grid(n)
for n_row, row in enumerate(grid):
for n_col in range(0, len(row)):
row[n_col] = get_lowest_int(grid, n_row, n_col)
print(' '.join(map(str, row)))
main(int(input()))
Test details
Test 1
Verdict: ACCEPTED
| input |
|---|
| 1 |
| correct output |
|---|
| 1 |
| user output |
|---|
| 1 |
Test 2
Verdict: ACCEPTED
| input |
|---|
| 2 |
| correct output |
|---|
| 1 2 2 1 |
| user output |
|---|
| 1 2 2 1 |
Test 3
Verdict: WRONG ANSWER
| 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 3 None 3 4 1 2 None 4 3 2 1 None 5 None None None 1 |
Test 4
Verdict: WRONG ANSWER
| 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 ... Truncated |
Test 5
Verdict: WRONG ANSWER
| 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 ... Truncated |
Test 6
Verdict: WRONG ANSWER
| 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 ... Truncated |
