結果
| 問題 |
No.133 カードゲーム
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-08-18 13:43:50 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 651 bytes |
| コンパイル時間 | 1,542 ms |
| コンパイル使用メモリ | 168,984 KB |
| 実行使用メモリ | 7,716 KB |
| 最終ジャッジ日時 | 2025-08-18 13:43:53 |
| 合計ジャッジ時間 | 2,585 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 19 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define INF 1LL<<60
int main(){
ll n,a=0,b=0;cin>>n;
vector<ll> f(n),g(n);
for(auto& i:f)cin>>i;
for(auto& i:g)cin>>i;
sort(f.begin(),f.end());
sort(g.begin(),g.end());
do{
do{
ll sub=0,ass=0;
for(ll i=0;i<n;i++){
if(f[i]>g[i])sub++;
else ass++;
}
if(sub>ass)a++;
b++;
}while(next_permutation(g.begin(),g.end()));
}while(next_permutation(f.begin(),f.end()));
cout<<fixed<<setprecision(10)<<(ld)a/(ld)(b)<<endl;
}