Submission #58710377


Source Code Expand

#include<bits/stdc++.h>
#define int long long
using namespace std;
const int N=1e6;
int n;
double sum=0;
struct node{
	int x,y;
}a[N];
double dst(int x,int xx,int y,int yy){
	return sqrt((x-xx)*(x-xx)+(y-yy)*(y-yy));
}
signed main()
{
	cin>>n;
	sum+=dst(0,a[1].x,0,a[1].y);
	for(int i=1;i<=n;i++){
		cin>>a[i].x>>a[i].y;
		sum+=dst(a[i].x,a[i-1].x,a[i].y,a[i-1].y);
	}
	sum+=dst(0,a[n].x,0,a[n].y);
	printf("%.7lf\n",sum);
	return 0;
}

Submission Info

Submission Time
Task B - Traveling Takahashi Problem
User Sin_qwq
Language C++ 20 (gcc 12.2)
Score 150
Code Size 458 Byte
Status AC
Exec Time 113 ms
Memory 6904 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 43 ms 6836 KiB
random_02.txt AC 21 ms 5284 KiB
random_03.txt AC 42 ms 6904 KiB
random_04.txt AC 10 ms 4484 KiB
random_05.txt AC 110 ms 6904 KiB
random_06.txt AC 14 ms 4192 KiB
random_07.txt AC 103 ms 6804 KiB
random_08.txt AC 4 ms 3908 KiB
random_09.txt AC 1 ms 3848 KiB
random_10.txt AC 1 ms 3724 KiB
random_11.txt AC 113 ms 6796 KiB
sample_01.txt AC 1 ms 3752 KiB
sample_02.txt AC 1 ms 3780 KiB
sample_03.txt AC 1 ms 3848 KiB