Submission #3625100


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

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)

dist = np.array([np.inf for _ in range(N+2)])
dist[0] = 0 
remain = set(range(N+2))
Q = []
heapq.heappush(Q,(0,0))
while Q:
    c, vn = heapq.heappop(Q)
    if vn not in remain or c > dist[c]:
        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 1 not in remain:
        break
print(dist[1])

Submission Info

Submission Time
Task E - Cosmic Rays
User Tallfall
Language Python (3.4.3)
Score 0
Code Size 977 Byte
Status RE
Exec Time 746 ms
Memory 60584 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 600
Status
AC × 1
RE × 2
AC × 17
RE × 32
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 RE 151 ms 12236 KB
0_01.txt AC 151 ms 12236 KB
0_02.txt RE 150 ms 12236 KB
1_00.txt RE 150 ms 12236 KB
1_01.txt RE 151 ms 12236 KB
1_02.txt RE 208 ms 57632 KB
1_03.txt RE 571 ms 58968 KB
1_04.txt AC 256 ms 58180 KB
1_05.txt RE 210 ms 58668 KB
1_06.txt AC 236 ms 57744 KB
1_07.txt AC 275 ms 57968 KB
1_08.txt RE 210 ms 58404 KB
1_09.txt RE 210 ms 58764 KB
1_10.txt AC 213 ms 59172 KB
1_11.txt RE 210 ms 58080 KB
1_12.txt AC 331 ms 58312 KB
1_13.txt AC 221 ms 58956 KB
1_14.txt RE 204 ms 59252 KB
1_15.txt RE 206 ms 59288 KB
1_16.txt RE 208 ms 59172 KB
1_17.txt RE 208 ms 58668 KB
1_18.txt RE 207 ms 58180 KB
1_19.txt RE 226 ms 59252 KB
1_20.txt AC 215 ms 58852 KB
1_21.txt AC 227 ms 57516 KB
1_22.txt RE 217 ms 58740 KB
1_23.txt RE 304 ms 58740 KB
1_24.txt RE 204 ms 59288 KB
1_25.txt RE 302 ms 58288 KB
1_26.txt RE 205 ms 58516 KB
1_27.txt AC 607 ms 60060 KB
1_28.txt RE 244 ms 58860 KB
1_29.txt AC 565 ms 59680 KB
1_30.txt AC 222 ms 58288 KB
1_31.txt AC 239 ms 58764 KB
1_32.txt RE 252 ms 59172 KB
1_33.txt RE 210 ms 57856 KB
1_34.txt RE 211 ms 57532 KB
1_35.txt RE 212 ms 59288 KB
1_36.txt RE 204 ms 59076 KB
1_37.txt RE 211 ms 58288 KB
1_38.txt RE 206 ms 59288 KB
1_39.txt RE 215 ms 59252 KB
1_40.txt RE 213 ms 58288 KB
1_41.txt RE 216 ms 59380 KB
1_42.txt AC 663 ms 57628 KB
1_43.txt AC 746 ms 60584 KB
1_44.txt AC 694 ms 59680 KB
1_45.txt AC 731 ms 60252 KB