Submission #3609824


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
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))
inf = float('inf')
dist = np.array([inf for _ in range(N+2)])
dist[0] = 0 
import heapq

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)) 
print(dist[1])

Submission Info

Submission Time
Task E - Cosmic Rays
User Tallfall
Language Python (3.4.3)
Score 0
Code Size 907 Byte
Status TLE
Exec Time 2111 ms
Memory 71552 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 286 ms 20852 KB
0_01.txt AC 149 ms 12196 KB
0_02.txt AC 150 ms 12196 KB
1_00.txt AC 150 ms 12488 KB
1_01.txt AC 149 ms 12196 KB
1_02.txt AC 702 ms 57692 KB
1_03.txt AC 690 ms 58364 KB
1_04.txt AC 637 ms 58432 KB
1_05.txt AC 756 ms 58700 KB
1_06.txt AC 663 ms 57788 KB
1_07.txt AC 618 ms 57980 KB
1_08.txt AC 684 ms 58656 KB
1_09.txt AC 731 ms 58812 KB
1_10.txt AC 639 ms 59132 KB
1_11.txt AC 669 ms 58076 KB
1_12.txt AC 669 ms 58108 KB
1_13.txt AC 674 ms 58916 KB
1_14.txt AC 711 ms 59248 KB
1_15.txt AC 726 ms 59248 KB
1_16.txt AC 692 ms 59132 KB
1_17.txt AC 737 ms 58700 KB
1_18.txt AC 729 ms 58432 KB
1_19.txt AC 745 ms 59248 KB
1_20.txt AC 658 ms 58852 KB
1_21.txt AC 650 ms 57880 KB
1_22.txt AC 738 ms 58700 KB
1_23.txt AC 715 ms 58700 KB
1_24.txt AC 697 ms 59248 KB
1_25.txt AC 666 ms 58364 KB
1_26.txt AC 734 ms 58476 KB
1_27.txt AC 691 ms 57784 KB
1_28.txt AC 729 ms 58820 KB
1_29.txt AC 692 ms 59020 KB
1_30.txt AC 632 ms 58540 KB
1_31.txt AC 648 ms 58812 KB
1_32.txt AC 707 ms 59132 KB
1_33.txt AC 671 ms 58108 KB
1_34.txt AC 606 ms 57784 KB
1_35.txt AC 629 ms 59248 KB
1_36.txt AC 622 ms 58916 KB
1_37.txt AC 606 ms 58376 KB
1_38.txt TLE 2111 ms 69636 KB
1_39.txt TLE 2110 ms 71552 KB
1_40.txt TLE 2111 ms 68712 KB
1_41.txt TLE 2111 ms 69632 KB
1_42.txt AC 684 ms 57880 KB
1_43.txt AC 735 ms 59248 KB
1_44.txt AC 690 ms 59148 KB
1_45.txt AC 797 ms 59144 KB