結果
| 問題 |
No.133 カードゲーム
|
| コンテスト | |
| ユーザー |
slowly_cplusplu
|
| 提出日時 | 2022-09-16 10:55:23 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 466 bytes |
| コンパイル時間 | 1,503 ms |
| コンパイル使用メモリ | 169,896 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-12-21 06:16:10 |
| 合計ジャッジ時間 | 2,543 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 19 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n)for(int i=0;i<(int)(n);i++)
using ll=long long;
int main(){
int n;
cin>>n;
int a[n],b[n],c[n];
rep(i,n)cin>>a[i];
rep(i,n)cin>>b[i];
rep(i,n)c[i]=i;
double d=0;
do{
int e=0;
rep(i,n)if(a[i]>b[c[i]])e++;
if(e>n/2)d++;
}while(next_permutation(c,c+n));
double nk=1;
rep(i,n)nk*=i+1;
cout<<fixed<<setprecision(5);
cout<<d/nk<<endl;
}
slowly_cplusplu