結果

問題 No.133 カードゲーム
ユーザー いあ
提出日時 2025-09-13 04:23:56
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 962 bytes
コンパイル時間 2,412 ms
コンパイル使用メモリ 199,860 KB
実行使用メモリ 7,716 KB
最終ジャッジ日時 2025-09-13 04:24:01
合計ジャッジ時間 4,029 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 19
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define rep(i, a, n) for (int i = a; i < n; i++)
using ll = long long;
using ld = long double;
using pl = pair<ll, ll>;
using vl = vector<ll>;
using vvl = vector<vl>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vc = vector<char>;
using vvc = vector<vc>;
const int mod = 998244353;
const ll hashh = 2147483647;

int main(){
    ll n,point = 0;
    ld pt = 0,yes = 0;
    cin >> n;
    vl a(n),b(n);
    rep(i,0,n) cin >> a[i];
    rep(i,0,n) cin >> b[i];
    sort(a.begin(),a.end());
    sort(b.begin(),b.end());
    do{
        do{
            point = 0;
            rep(i,0,n){
                if(a[i] > b[i]){
                    point++;
                }
            }
            pt++;
            if(point > n/2){
                yes++;
            }
        }while(next_permutation(a.begin(),a.end()));
    }while(next_permutation(b.begin(),b.end()));
    printf("%.10Lf\n",yes/pt);
    return 0;
}
0