| Task: | Ruudukko |
| Sender: | VirtuesL |
| Submission time: | 2019-10-12 18:44:16 +0300 |
| Language: | Python3 (PyPy3) |
| Status: | READY |
| Result: | 0 |
| group | verdict | score |
|---|---|---|
| #1 | RUNTIME ERROR | 0 |
| test | verdict | time | |
|---|---|---|---|
| #1 | RUNTIME ERROR | 0.07 s | details |
| #2 | ACCEPTED | 0.05 s | details |
| #3 | WRONG ANSWER | 0.05 s | details |
| #4 | WRONG ANSWER | 0.14 s | details |
| #5 | TIME LIMIT EXCEEDED | -- | details |
| #6 | TIME LIMIT EXCEEDED | -- | details |
Code
x = int(input())
fl = [[i+1 for i in range(x)] if j == 0 else [0 for i in range(x)] for j in range(x)]
def pront():
return "\n".join([" ".join(map(str,l)) for l in fl])
def swapRow(lt):
tmp = [i for i in lt]
for i in range(0,x,2):
try:
a = tmp[i+1]
tmp[i+1] = tmp[i]
tmp[i] = a
except IndexError:
a = tmp[i]
tmp[i] = tmp[i-1]
tmp[i-1] = a
return tmp
def conflict(lt,l):
cols = list(zip(*fl[:l]))
for (i, val), col in zip(enumerate(lt), cols):
if val in col:
return (i, val)
def correct(lt,l):
for i, _ in enumerate(lt):
conf = conflict(lt, l)
if conf:
pos, val = conflict(lt,l)
cols = list(zip(*fl[:l]))
for j in range(x):
if val not in cols[::-1][j]:
lt[pos] = lt[x-(j+1)]
lt[x-(j+1)] = val
break
conf = conflict(lt,l)
def swap2Row(lt):
tmp = [i for i in lt]
for i in range(x-2):
a = tmp[i+2]
tmp[i+2] = tmp[i]
tmp[i] = a
if len(tmp)%2 == 0:
pass
else:
a = tmp[x-1]
tmp[x-1] = tmp[x-2]
tmp[x-2] = a
return tmp
fl[1] = swapRow(fl[0])
for i, row in enumerate(fl[:x-2]):
fl[i+2] = swap2Row(fl[i])
correct(fl[i+2],i+2)
print(pront())
Test details
Test 1
Verdict: RUNTIME ERROR
| input |
|---|
| 1 |
| correct output |
|---|
| 1 |
| user output |
|---|
| (empty) |
Error:
Traceback (most recent call last):
File "input/code.py", line 56, in <module>
fl[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 5 3 3 4 5 1 2 4 5 2 3 1 5 3 1 2 4 |
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: TIME LIMIT EXCEEDED
| input |
|---|
| 99 |
| correct output |
|---|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 ... |
| user output |
|---|
| (empty) |
Test 6
Verdict: TIME LIMIT EXCEEDED
| input |
|---|
| 100 |
| correct output |
|---|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 ... |
| user output |
|---|
| (empty) |
