Submission #16494656


Source Code Expand

Copy
import sys
from scipy.sparse import csr_matrix
import scipy.sparse.linalg as sp

N, M = map(int, input().split())
G = [[]for _ in range(N)]
in_deg=[0]*N
for _ in range(M):
  a,b=map(int,input().split())
  G[a-1].append(b-1)
  in_deg[b-1] += 1

A = [(a,a,1) for a in range(N)]
A += [(a,b,-0.9/in_deg[b]) for a in range(N) for b in G[a]]
rows, cols, vals = zip(*A)

mat = csr_matrix((vals, (rows, cols)), (N, N))
print(*sp.spsolve(mat, [0.1] * N))

Submission Info

Submission Time
Task E - Page Rank
User maspy
Language Python (3.8.2)
Score 0
Code Size 462 Byte
Status WA
Exec Time 253 ms
Memory 52112 KB

Judge Result

Set Name All
Score / Max Score 0 / 100
Status
AC × 2
WA × 23
Set Name Test Cases
All 10_sample_01.txt, 10_sample_02.txt, 20-random_small-00.txt, 20-random_small-01.txt, 20-random_small-02.txt, 20-random_small-03.txt, 20-random_small-04.txt, 20-random_small-05.txt, 20-random_small-06.txt, 20-random_small-07.txt, 20-random_small-08.txt, 20-random_small-09.txt, 30-random_large-00.txt, 30-random_large-01.txt, 30-random_large-02.txt, 30-random_large-03.txt, 30-random_large-04.txt, 30-random_large-05.txt, 30-random_large-06.txt, 30-random_large-07.txt, 30-random_large-08.txt, 30-random_large-09.txt, 40-random_max-00.txt, 40-random_max-01.txt, 40-random_max-02.txt
Case Name Status Exec Time Memory
10_sample_01.txt AC 211 ms 43456 KB
10_sample_02.txt AC 187 ms 43412 KB
20-random_small-00.txt WA 200 ms 43472 KB
20-random_small-01.txt WA 193 ms 43592 KB
20-random_small-02.txt WA 194 ms 43296 KB
20-random_small-03.txt WA 199 ms 43684 KB
20-random_small-04.txt WA 199 ms 43600 KB
20-random_small-05.txt WA 191 ms 43508 KB
20-random_small-06.txt WA 190 ms 43584 KB
20-random_small-07.txt WA 201 ms 43764 KB
20-random_small-08.txt WA 202 ms 43556 KB
20-random_small-09.txt WA 190 ms 43376 KB
30-random_large-00.txt WA 196 ms 43348 KB
30-random_large-01.txt WA 199 ms 44140 KB
30-random_large-02.txt WA 227 ms 50240 KB
30-random_large-03.txt WA 224 ms 48720 KB
30-random_large-04.txt WA 198 ms 45972 KB
30-random_large-05.txt WA 222 ms 46904 KB
30-random_large-06.txt WA 210 ms 44812 KB
30-random_large-07.txt WA 211 ms 46720 KB
30-random_large-08.txt WA 233 ms 50392 KB
30-random_large-09.txt WA 239 ms 51256 KB
40-random_max-00.txt WA 247 ms 52084 KB
40-random_max-01.txt WA 253 ms 52060 KB
40-random_max-02.txt WA 246 ms 52112 KB