Submission #3616150
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 not remain: break print(dist[1])
Submission Info
Submission Time | |
---|---|
Task | E - Cosmic Rays |
User | Tallfall |
Language | Python (3.4.3) |
Score | 0 |
Code Size | 976 Byte |
Status | TLE |
Exec Time | 2110 ms |
Memory | 77172 KB |
Judge Result
Set Name | Sample | All | ||||||
---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 600 | ||||||
Status |
|
|
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 | 148 ms | 12108 KB |
0_01.txt | AC | 148 ms | 12024 KB |
0_02.txt | AC | 147 ms | 12040 KB |
1_00.txt | AC | 148 ms | 12024 KB |
1_01.txt | AC | 148 ms | 12040 KB |
1_02.txt | AC | 672 ms | 57580 KB |
1_03.txt | AC | 695 ms | 58440 KB |
1_04.txt | AC | 650 ms | 58240 KB |
1_05.txt | AC | 689 ms | 58672 KB |
1_06.txt | AC | 625 ms | 57760 KB |
1_07.txt | AC | 625 ms | 57952 KB |
1_08.txt | AC | 657 ms | 58788 KB |
1_09.txt | AC | 752 ms | 59032 KB |
1_10.txt | AC | 650 ms | 59120 KB |
1_11.txt | AC | 646 ms | 58296 KB |
1_12.txt | AC | 648 ms | 57856 KB |
1_13.txt | AC | 631 ms | 59016 KB |
1_14.txt | AC | 659 ms | 59748 KB |
1_15.txt | AC | 715 ms | 59880 KB |
1_16.txt | AC | 681 ms | 59292 KB |
1_17.txt | AC | 681 ms | 58672 KB |
1_18.txt | AC | 687 ms | 58780 KB |
1_19.txt | AC | 689 ms | 59876 KB |
1_20.txt | AC | 640 ms | 58824 KB |
1_21.txt | AC | 624 ms | 57592 KB |
1_22.txt | AC | 686 ms | 59224 KB |
1_23.txt | AC | 676 ms | 59108 KB |
1_24.txt | AC | 703 ms | 59220 KB |
1_25.txt | AC | 662 ms | 58572 KB |
1_26.txt | AC | 693 ms | 59356 KB |
1_27.txt | AC | 675 ms | 58260 KB |
1_28.txt | AC | 733 ms | 59496 KB |
1_29.txt | AC | 693 ms | 59740 KB |
1_30.txt | AC | 631 ms | 58364 KB |
1_31.txt | AC | 647 ms | 58784 KB |
1_32.txt | AC | 700 ms | 59548 KB |
1_33.txt | AC | 692 ms | 58248 KB |
1_34.txt | AC | 648 ms | 57464 KB |
1_35.txt | AC | 643 ms | 59220 KB |
1_36.txt | AC | 615 ms | 59008 KB |
1_37.txt | AC | 634 ms | 58236 KB |
1_38.txt | TLE | 2110 ms | 77172 KB |
1_39.txt | TLE | 2110 ms | 74468 KB |
1_40.txt | TLE | 2110 ms | 73436 KB |
1_41.txt | TLE | 2110 ms | 74868 KB |
1_42.txt | AC | 654 ms | 57592 KB |
1_43.txt | AC | 680 ms | 60516 KB |
1_44.txt | AC | 666 ms | 59612 KB |
1_45.txt | AC | 720 ms | 61224 KB |