Submission #3616198


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()
rs,rt = 0, 0
N = int(input())
xyr = [(xs, ys, rs),(xt, yt,rt)] + [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:
    k = heapq.heappop(Q)
    k = k[1]
    if k not in remain:
        continue
    remain.remove(k)
    for j in remain:
        if dist[k] + edge[k][j] < dist[j]:
            dist[j] = dist[k] + edge[k][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 981 Byte
Status TLE
Exec Time 2110 ms
Memory 74852 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 307 ms 21428 KB
0_01.txt AC 153 ms 12024 KB
0_02.txt AC 152 ms 12040 KB
1_00.txt AC 151 ms 12040 KB
1_01.txt AC 152 ms 12040 KB
1_02.txt AC 478 ms 57988 KB
1_03.txt AC 661 ms 59044 KB
1_04.txt AC 249 ms 58240 KB
1_05.txt AC 407 ms 58840 KB
1_06.txt AC 233 ms 57776 KB
1_07.txt AC 267 ms 57968 KB
1_08.txt AC 586 ms 58352 KB
1_09.txt AC 494 ms 59032 KB
1_10.txt AC 199 ms 59104 KB
1_11.txt AC 663 ms 58064 KB
1_12.txt AC 317 ms 58136 KB
1_13.txt AC 215 ms 59016 KB
1_14.txt AC 246 ms 59220 KB
1_15.txt AC 748 ms 59876 KB
1_16.txt AC 665 ms 59292 KB
1_17.txt AC 260 ms 58688 KB
1_18.txt AC 669 ms 58776 KB
1_19.txt AC 656 ms 59852 KB
1_20.txt AC 208 ms 58824 KB
1_21.txt AC 223 ms 57576 KB
1_22.txt AC 681 ms 59224 KB
1_23.txt AC 652 ms 58968 KB
1_24.txt AC 369 ms 59252 KB
1_25.txt AC 657 ms 58572 KB
1_26.txt AC 644 ms 59348 KB
1_27.txt AC 609 ms 57480 KB
1_28.txt AC 642 ms 59484 KB
1_29.txt AC 540 ms 59612 KB
1_30.txt AC 212 ms 58348 KB
1_31.txt AC 226 ms 58788 KB
1_32.txt AC 722 ms 59104 KB
1_33.txt AC 696 ms 58312 KB
1_34.txt AC 240 ms 57480 KB
1_35.txt AC 537 ms 59220 KB
1_36.txt AC 572 ms 59016 KB
1_37.txt AC 630 ms 58236 KB
1_38.txt TLE 2110 ms 74724 KB
1_39.txt TLE 2110 ms 74616 KB
1_40.txt TLE 2110 ms 73436 KB
1_41.txt TLE 2110 ms 74852 KB
1_42.txt AC 678 ms 57576 KB
1_43.txt AC 680 ms 60516 KB
1_44.txt AC 663 ms 59624 KB
1_45.txt AC 716 ms 60184 KB