| Task: | Ruudukko | 
| Sender: | johannes | 
| Submission time: | 2022-11-09 12:46:19 +0200 | 
| Language: | Python3 (CPython3) | 
| Status: | READY | 
| Result: | 0 | 
| group | verdict | score | 
|---|---|---|
| #1 | RUNTIME ERROR | 0 | 
| #2 | RUNTIME ERROR | 0 | 
| #3 | RUNTIME ERROR | 0 | 
| test | verdict | time | group | |
|---|---|---|---|---|
| #1 | RUNTIME ERROR | 0.02 s | 1, 2, 3 | details | 
| #2 | RUNTIME ERROR | 0.02 s | 1, 2, 3 | details | 
| #3 | RUNTIME ERROR | 0.02 s | 1, 2, 3 | details | 
| #4 | RUNTIME ERROR | 0.02 s | 2, 3 | details | 
| #5 | RUNTIME ERROR | 0.02 s | 2, 3 | details | 
| #6 | RUNTIME ERROR | 0.02 s | 2, 3 | details | 
| #7 | RUNTIME ERROR | 0.02 s | 3 | details | 
| #8 | RUNTIME ERROR | 0.02 s | 3 | details | 
| #9 | RUNTIME ERROR | 0.02 s | 3 | details | 
Code
import numpy as np
n = int(input())
matrix = []
matrix2 = []
for i in range(n):
    l = []
    l.append(input())
    l = [int(i) for i in l[0].split()]
    matrix.append(l)
    matrix2.extend(l)
#n = 3
#matrix = [[2, 1, 3], [1, 1, 1], [9, 2, 7]]
def possible_moves(matrix=matrix, n=n):
    coords = {}
    aMatrix = [[0 for _ in range(n**2)]
                  for __ in range(n**2)]
 
    for pY in range(n):
        for pX in range(n):
            coords[f"{pX}:{pY}"] = []
    keys = list(coords.keys())
    pY = 0
    pX = 0
    t = 0
    while pY < n:
        
        mY = [i[pX] for i in matrix]
        mX = [i for i in matrix[pY]]
 
        for i in range(n):
            
            if mY[i] < matrix[pY][pX] and i != pY:
                #coords[f"{pX}:{pY}"] ja f"{pX}:{i}") yhteinen väli matriisilta
                #print(f"{pX}:{pY}", f"{pX}:{i}")
                x=keys.index(f"{pX}:{pY}")
                y=keys.index(f"{pX}:{i}")
                aMatrix[x][y]=1
                #coords[f"{pX}:{pY}"].append(f"{pX}:{i}")
                pass
            if mX[i] < matrix[pY][pX] and i != pX:
                #coords[f"{pX}:{pY}"].append(f"{i}:{pY}")
                x=keys.index(f"{pX}:{pY}")
                y=keys.index(f"{i}:{pY}")
                aMatrix[x][y] = 1
                pass
    
        if pX == n - 1:
            pY += 1
 
        t += 1
        pX += 1
 
        if pX == n:
            pX = 0
    #print(np.matrix(aMatrix),end='\n\n')
    return np.matrix(aMatrix)
a = possible_moves()
#print(a)
s = 0
for i in range(1,n**2+1):
    b = np.linalg.matrix_power(a,i)
    s += b.sum()
print(s+n**2)
Test details
Test 1
Group: 1, 2, 3
Verdict: RUNTIME ERROR
| input | 
|---|
| 3 1 1 1 1 1 1 1 1 1  | 
| correct output | 
|---|
| 9 | 
| user output | 
|---|
| (empty) | 
Error:
Traceback (most recent call last):
  File "/box/input/code.py", line 1, in <module>
    im...Test 2
Group: 1, 2, 3
Verdict: RUNTIME ERROR
| input | 
|---|
| 3 1 2 3 6 5 4 7 8 9  | 
| correct output | 
|---|
| 135 | 
| user output | 
|---|
| (empty) | 
Error:
Traceback (most recent call last):
  File "/box/input/code.py", line 1, in <module>
    im...Test 3
Group: 1, 2, 3
Verdict: RUNTIME ERROR
| input | 
|---|
| 3 7 8 1 4 5 4 3 9 6  | 
| correct output | 
|---|
| 57 | 
| user output | 
|---|
| (empty) | 
Error:
Traceback (most recent call last):
  File "/box/input/code.py", line 1, in <module>
    im...Test 4
Group: 2, 3
Verdict: RUNTIME ERROR
| input | 
|---|
| 100 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...  | 
| correct output | 
|---|
| 10000 | 
| user output | 
|---|
| (empty) | 
Error:
Traceback (most recent call last):
  File "/box/input/code.py", line 1, in <module>
    im...Test 5
Group: 2, 3
Verdict: RUNTIME ERROR
| input | 
|---|
| 100 1 2 3 4 5 6 7 8 9 10 11 12 13 ...  | 
| correct output | 
|---|
| 187458477 | 
| user output | 
|---|
| (empty) | 
Error:
Traceback (most recent call last):
  File "/box/input/code.py", line 1, in <module>
    im...Test 6
Group: 2, 3
Verdict: RUNTIME ERROR
| input | 
|---|
| 100 2995 8734 1018 2513 7971 5063 ...  | 
| correct output | 
|---|
| 964692694 | 
| user output | 
|---|
| (empty) | 
Error:
Traceback (most recent call last):
  File "/box/input/code.py", line 1, in <module>
    im...Test 7
Group: 3
Verdict: RUNTIME ERROR
| input | 
|---|
| 1000 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...  | 
| correct output | 
|---|
| 1000000 | 
| user output | 
|---|
| (empty) | 
Error:
Traceback (most recent call last):
  File "/box/input/code.py", line 1, in <module>
    im...Test 8
Group: 3
Verdict: RUNTIME ERROR
| input | 
|---|
| 1000 1 2 3 4 5 6 7 8 9 10 11 12 13 ...  | 
| correct output | 
|---|
| 229147081 | 
| user output | 
|---|
| (empty) | 
Error:
Traceback (most recent call last):
  File "/box/input/code.py", line 1, in <module>
    im...Test 9
Group: 3
Verdict: RUNTIME ERROR
| input | 
|---|
| 1000 520283 805991 492643 75254 527...  | 
| correct output | 
|---|
| 951147313 | 
| user output | 
|---|
| (empty) | 
Error:
Traceback (most recent call last):
  File "/box/input/code.py", line 1, in <module>
    im...