Submission #3625182


Source Code Expand

def flpl(): return [float(i) for i in input().split()]
def inpl(): return [int(i) for i in input().split()]
import numpy as np
import heapq
def dijkstra(vnum, vs, edge):
    dist = np.array([np.inf for _ in range(vnum)])
    dist[vs] = 0 
    remain = set(range(vnum))
    Q = []
    heapq.heappush(Q,(0,vs))
    while Q:
        c, vn = heapq.heappop(Q)
        if vn not in remain :
            continue
        remain.remove(vn)
        for j in remain:
            if dist[vn] + edge[vn][j] < dist[j]:
                dist[j] = dist[vn] + edge[vn][j] 
                heapq.heappush(Q,(dist[j],j)) 
        if not remain:
            break
    return dist

xs, ys, xt, yt = flpl()
N = int(input())
xyr = [(xs, ys, 0),(xt, yt, 0)] + [inpl() for _ in range(N)]
X, Y, R = np.array(xyr).T
X, Y, R = np.tile(X, (N+2, 1)), np.tile(Y, (N+2, 1)), np.tile(R, (N+2, 1))
edge = np.maximum(np.zeros((N+2, N+2)), np.sqrt(np.square(X-X.T) +\
                  np.square(Y-Y.T))-(R+R.T)) +\
                  np.diag(np.ones(N+2)*np.inf)
D = dijkstra(N+2, 0, edge)
print(D[1])

Submission Info

Submission Time
Task E - Cosmic Rays
User Tallfall
Language Python (3.4.3)
Score 0
Code Size 1097 Byte
Status TLE
Exec Time 2110 ms
Memory 74764 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 600
Status
AC × 3
AC × 45
TLE × 4
Set Name Test Cases
Sample 0_00.txt, 0_01.txt, 0_02.txt
All 0_00.txt, 0_01.txt, 0_02.txt, 1_00.txt, 1_01.txt, 1_02.txt, 1_03.txt, 1_04.txt, 1_05.txt, 1_06.txt, 1_07.txt, 1_08.txt, 1_09.txt, 1_10.txt, 1_11.txt, 1_12.txt, 1_13.txt, 1_14.txt, 1_15.txt, 1_16.txt, 1_17.txt, 1_18.txt, 1_19.txt, 1_20.txt, 1_21.txt, 1_22.txt, 1_23.txt, 1_24.txt, 1_25.txt, 1_26.txt, 1_27.txt, 1_28.txt, 1_29.txt, 1_30.txt, 1_31.txt, 1_32.txt, 1_33.txt, 1_34.txt, 1_35.txt, 1_36.txt, 1_37.txt, 1_38.txt, 1_39.txt, 1_40.txt, 1_41.txt, 1_42.txt, 1_43.txt, 1_44.txt, 1_45.txt
Case Name Status Exec Time Memory
0_00.txt AC 151 ms 12192 KB
0_01.txt AC 149 ms 12080 KB
0_02.txt AC 149 ms 12080 KB
1_00.txt AC 149 ms 12080 KB
1_01.txt AC 149 ms 12080 KB
1_02.txt AC 646 ms 58028 KB
1_03.txt AC 660 ms 59068 KB
1_04.txt AC 583 ms 58280 KB
1_05.txt AC 680 ms 59264 KB
1_06.txt AC 596 ms 57716 KB
1_07.txt AC 615 ms 57940 KB
1_08.txt AC 645 ms 58812 KB
1_09.txt AC 635 ms 59072 KB
1_10.txt AC 598 ms 59144 KB
1_11.txt AC 622 ms 58160 KB
1_12.txt AC 621 ms 58288 KB
1_13.txt AC 607 ms 58928 KB
1_14.txt AC 646 ms 59788 KB
1_15.txt AC 674 ms 59260 KB
1_16.txt AC 645 ms 59332 KB
1_17.txt AC 672 ms 59136 KB
1_18.txt AC 638 ms 58676 KB
1_19.txt AC 641 ms 59788 KB
1_20.txt AC 594 ms 58824 KB
1_21.txt AC 582 ms 57616 KB
1_22.txt AC 660 ms 59136 KB
1_23.txt AC 650 ms 59136 KB
1_24.txt AC 660 ms 59660 KB
1_25.txt AC 631 ms 58612 KB
1_26.txt AC 633 ms 58488 KB
1_27.txt AC 617 ms 58144 KB
1_28.txt AC 648 ms 59520 KB
1_29.txt AC 637 ms 59652 KB
1_30.txt AC 584 ms 58260 KB
1_31.txt AC 609 ms 58824 KB
1_32.txt AC 627 ms 59460 KB
1_33.txt AC 670 ms 57828 KB
1_34.txt AC 641 ms 57376 KB
1_35.txt AC 655 ms 59224 KB
1_36.txt AC 606 ms 58928 KB
1_37.txt AC 595 ms 58248 KB
1_38.txt TLE 2110 ms 74508 KB
1_39.txt TLE 2110 ms 74764 KB
1_40.txt TLE 2110 ms 73588 KB
1_41.txt TLE 2110 ms 74380 KB
1_42.txt AC 602 ms 57616 KB
1_43.txt AC 654 ms 59920 KB
1_44.txt AC 636 ms 59652 KB
1_45.txt AC 703 ms 61248 KB