提出 #58685366
ソースコード 拡げる
#include <bits/stdc++.h>
#define ll long long
using namespace std;
ll n;
long double x[200009], y[200009], res, prevx = 0, prevy = 0;
int main() {
cin>>n;
for(int i=0;i<n;i++){
cin>>x[i]>>y[i];
res += sqrtl(fabsl(prevx - x[i]) * fabsl(prevx - x[i]) + fabsl(prevy - y[i]) * fabsl(prevy - y[i]));
prevx = x[i];
prevy = y[i];
}
res += sqrtl(fabsl(x[n - 1]) * fabsl(x[n - 1]) + fabsl(y[n - 1]) * fabsl(y[n - 1]));
cout<<fixed<<setprecision(10)<<res;
return 0;
}
提出情報
| 提出日時 | |
|---|---|
| 問題 | B - Traveling Takahashi Problem |
| ユーザ | imadra |
| 言語 | C++ 20 (gcc 12.2) |
| 得点 | 150 |
| コード長 | 531 Byte |
| 結果 | AC |
| 実行時間 | 153 ms |
| メモリ | 10084 KiB |
ジャッジ結果
| セット名 | Sample | All | ||||
|---|---|---|---|---|---|---|
| 得点 / 配点 | 0 / 0 | 150 / 150 | ||||
| 結果 |
|
|
| セット名 | テストケース |
|---|---|
| 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 |
| ケース名 | 結果 | 実行時間 | メモリ |
|---|---|---|---|
| random_01.txt | AC | 79 ms | 9956 KiB |
| random_02.txt | AC | 38 ms | 6696 KiB |
| random_03.txt | AC | 78 ms | 10004 KiB |
| random_04.txt | AC | 17 ms | 5152 KiB |
| random_05.txt | AC | 144 ms | 10084 KiB |
| random_06.txt | AC | 20 ms | 4572 KiB |
| random_07.txt | AC | 144 ms | 10080 KiB |
| random_08.txt | AC | 5 ms | 3956 KiB |
| random_09.txt | AC | 1 ms | 3696 KiB |
| random_10.txt | AC | 1 ms | 3788 KiB |
| random_11.txt | AC | 153 ms | 10008 KiB |
| sample_01.txt | AC | 1 ms | 3660 KiB |
| sample_02.txt | AC | 1 ms | 3828 KiB |
| sample_03.txt | AC | 1 ms | 3788 KiB |