Submission #58705626
Source Code Expand
#include <bits/stdc++.h>
using namespace std;
int main(){
cout << fixed << setprecision(6);
int i,n,x,y,xp=0,yp=0;
double dis=0;
cin >> n;
for(i=0 ;i < n ; i++){
cin >> x >> y;
dis += sqrt(pow((x-xp),2)+pow((y-yp),2));
xp = x;
yp = y;
}
dis += sqrt(pow((0-xp),2)+pow((0-yp),2));
cout << dis << endl;
}
Submission Info
| Submission Time | |
|---|---|
| Task | B - Traveling Takahashi Problem |
| User | scentream |
| Language | C++ 20 (gcc 12.2) |
| Score | 150 |
| Code Size | 349 Byte |
| Status | AC |
| Exec Time | 114 ms |
| Memory | 3828 KiB |
Judge Result
| Set Name | Sample | All | ||||
|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 150 / 150 | ||||
| Status |
|
|
| 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 | 42 ms | 3792 KiB |
| random_02.txt | AC | 20 ms | 3736 KiB |
| random_03.txt | AC | 42 ms | 3772 KiB |
| random_04.txt | AC | 9 ms | 3824 KiB |
| random_05.txt | AC | 104 ms | 3824 KiB |
| random_06.txt | AC | 15 ms | 3704 KiB |
| random_07.txt | AC | 104 ms | 3804 KiB |
| random_08.txt | AC | 4 ms | 3792 KiB |
| random_09.txt | AC | 1 ms | 3772 KiB |
| random_10.txt | AC | 1 ms | 3640 KiB |
| random_11.txt | AC | 114 ms | 3772 KiB |
| sample_01.txt | AC | 1 ms | 3692 KiB |
| sample_02.txt | AC | 1 ms | 3616 KiB |
| sample_03.txt | AC | 1 ms | 3828 KiB |