Submission #16494663


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[b-1].append(a-1)
  in_deg[a-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 100
Code Size 462 Byte
Status AC
Exec Time 255 ms
Memory 52840 KB

Judge Result

Set Name All
Score / Max Score 100 / 100
Status
AC × 25
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 198 ms 43876 KB
10_sample_02.txt AC 186 ms 43956 KB
20-random_small-00.txt AC 194 ms 44584 KB
20-random_small-01.txt AC 195 ms 44176 KB
20-random_small-02.txt AC 190 ms 44160 KB
20-random_small-03.txt AC 193 ms 44100 KB
20-random_small-04.txt AC 189 ms 44208 KB
20-random_small-05.txt AC 197 ms 43900 KB
20-random_small-06.txt AC 191 ms 43844 KB
20-random_small-07.txt AC 200 ms 44652 KB
20-random_small-08.txt AC 193 ms 44408 KB
20-random_small-09.txt AC 190 ms 44212 KB
30-random_large-00.txt AC 195 ms 44380 KB
30-random_large-01.txt AC 196 ms 45028 KB
30-random_large-02.txt AC 220 ms 50956 KB
30-random_large-03.txt AC 213 ms 49256 KB
30-random_large-04.txt AC 208 ms 46584 KB
30-random_large-05.txt AC 214 ms 47680 KB
30-random_large-06.txt AC 210 ms 45500 KB
30-random_large-07.txt AC 222 ms 47484 KB
30-random_large-08.txt AC 239 ms 50492 KB
30-random_large-09.txt AC 247 ms 51820 KB
40-random_max-00.txt AC 255 ms 52772 KB
40-random_max-01.txt AC 240 ms 52668 KB
40-random_max-02.txt AC 241 ms 52840 KB