#include using namespace std; //typedef typedef unsigned int UINT; typedef unsigned long long ULL; typedef long long LL; typedef pair PLL; typedef tuple TLL3; typedef tuple TLL4; typedef set > setdownLL; #define PQ priority_queue typedef PQ, greater > pqupLL; //container utill #define ALL(v) (v).begin(),(v).end() #define CR [](auto element1, auto element2){return element1>element2;} #define LB lower_bound #define UP upper_bound #define PB push_back #define MP make_pair #define MT make_tuple //constant #define PI 3.141592653589793 int main(){ //input int N; cin >> N; int A[N], B[N]; int i; for(i=0; i> A[i]; } for(i=0; i> B[i]; } //calc sort(A,A+N); sort(B,B+N); int Awon=0, shobusu=0; int Awonsho, Bwonsho; do{ do{ Awonsho=0, Bwonsho=0; for(i=0; iB[i]) Awonsho++; else if(A[i]Bwonsho) Awon++; shobusu++; }while(next_permutation(B,B+N)); }while(next_permutation(A,A+N)); long double Awonlb=Awon, shobusulb=shobusu; //output cout << fixed << setprecision(5) << Awonlb/shobusulb << endl; return 0; }