Submission #8472141


Source Code Expand

Copy
#include<bits/stdc++.h>
#define pb push_back
#define ii pair<int,int>
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define INF 100000000000000000
#define modulo 1000000007
#define int long double
using namespace std;
vector<ii> data;
int dist(ii& a,ii& b){
      return sqrt((a.first-b.first)*(a.first-b.first)+(a.second-b.second)*(a.second-b.second));
}
int F(vector<int>&P){
      int ans=0;
      for(int i=1;i<P.size();i++){
            ans+=dist(data[P[i]],data[P[i-1]]);
      }
      return ans;
}
int32_t main(){
      ios_base::sync_with_stdio(false);
      cin.tie(NULL);
      //freopen("q.gir","r",stdin);
      int n;
      cin>>n;
      vector<int>A;
      for(int i=0;i<n;i++){
            A.pb(i);
      }
      for(int i=0;i<n;i++){
            int x,y;
            cin>>x>>y;
            data.pb({x,y});
      }
      int cnt=0,ans=0;
      do{
            ans+=F(A);
            cnt++;
      }while(next_permutation(all(A)));
      cout<<setprecision(15)<<ans/cnt;
}

Submission Info

Submission Time
Task C - Average Length
User theStaticMind
Language C++14 (GCC 5.4.1)
Score 300
Code Size 1041 Byte
Status AC
Exec Time 10 ms
Memory 256 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 3
AC × 15
Set Name Test Cases
Sample sample00, sample01, sample02
All handmade03, handmade04, handmade05, random06, random07, random08, random09, random10, random11, random12, random13, random14, sample00, sample01, sample02
Case Name Status Exec Time Memory
handmade03 AC 10 ms 256 KB
handmade04 AC 10 ms 256 KB
handmade05 AC 10 ms 256 KB
random06 AC 1 ms 256 KB
random07 AC 1 ms 256 KB
random08 AC 1 ms 256 KB
random09 AC 1 ms 256 KB
random10 AC 2 ms 256 KB
random11 AC 2 ms 256 KB
random12 AC 10 ms 256 KB
random13 AC 10 ms 256 KB
random14 AC 10 ms 256 KB
sample00 AC 1 ms 256 KB
sample01 AC 1 ms 256 KB
sample02 AC 10 ms 256 KB