結果

問題 No.133 カードゲーム
ユーザー nameko
提出日時 2025-08-18 13:42:54
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 669 bytes
コンパイル時間 1,658 ms
コンパイル使用メモリ 168,948 KB
実行使用メモリ 7,716 KB
最終ジャッジ日時 2025-08-18 13:42:57
合計ジャッジ時間 2,820 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3 WA * 1
other AC * 5 WA * 14
権限があれば一括ダウンロードができます

ソースコード

diff #

#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++;
            else if(sub<ass)b++;
        }while(next_permutation(g.begin(),g.end()));
    }while(next_permutation(f.begin(),f.end()));
    cout<<fixed<<setprecision(10)<<(ld)a/(ld)(a+b)<<endl;
}
0