Submission #58679864


Source Code Expand

N = int(input())

from math import sqrt
def f(X1,X2):
    return sqrt((X1[0]-X2[0])**2 + (X1[1]-X2[1])**2)

prev = (0,0)
cost = 0
for _ in range(N):
    x,y = map(int, input().split())
    curr = (x,y)
    cost += f(prev,curr)
    prev = curr

cost += f(prev,(0,0))

print(cost)

Submission Info

Submission Time
Task B - Traveling Takahashi Problem
User entropiajp
Language Python (PyPy 3.10-v7.3.12)
Score 150
Code Size 294 Byte
Status AC
Exec Time 134 ms
Memory 83240 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 150 / 150
Status
AC × 3
AC × 14
Set Name Test Cases
Sample sample_01.txt, sample_02.txt, sample_03.txt
All random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, random_10.txt, random_11.txt, sample_01.txt, sample_02.txt, sample_03.txt
Case Name Status Exec Time Memory
random_01.txt AC 120 ms 82880 KiB
random_02.txt AC 96 ms 82916 KiB
random_03.txt AC 121 ms 82764 KiB
random_04.txt AC 83 ms 83240 KiB
random_05.txt AC 134 ms 82740 KiB
random_06.txt AC 78 ms 83112 KiB
random_07.txt AC 126 ms 83124 KiB
random_08.txt AC 73 ms 82132 KiB
random_09.txt AC 55 ms 76264 KiB
random_10.txt AC 54 ms 76732 KiB
random_11.txt AC 127 ms 82920 KiB
sample_01.txt AC 54 ms 76380 KiB
sample_02.txt AC 54 ms 76672 KiB
sample_03.txt AC 53 ms 76740 KiB