結果

問題 No.133 カードゲーム
ユーザー cro68831269cro68831269
提出日時 2022-05-19 18:23:18
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 3 ms / 5,000 ms
コード長 1,027 bytes
コンパイル時間 2,735 ms
コンパイル使用メモリ 204,308 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-19 02:15:33
合計ジャッジ時間 3,301 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 2 ms
4,348 KB
testcase_05 AC 2 ms
4,348 KB
testcase_06 AC 2 ms
4,348 KB
testcase_07 AC 2 ms
4,348 KB
testcase_08 AC 2 ms
4,348 KB
testcase_09 AC 2 ms
4,348 KB
testcase_10 AC 2 ms
4,348 KB
testcase_11 AC 2 ms
4,348 KB
testcase_12 AC 2 ms
4,348 KB
testcase_13 AC 2 ms
4,348 KB
testcase_14 AC 2 ms
4,348 KB
testcase_15 AC 2 ms
4,348 KB
testcase_16 AC 2 ms
4,348 KB
testcase_17 AC 3 ms
4,348 KB
testcase_18 AC 2 ms
4,348 KB
testcase_19 AC 2 ms
4,348 KB
testcase_20 AC 2 ms
4,348 KB
testcase_21 AC 2 ms
4,348 KB
testcase_22 AC 2 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template<class T> using V = std::vector<T>;
#define REP(i, n) for (ll i=(ll)0; i<(ll)(n); i++)
#define REPS(i, s, n) for (ll i=(ll)(s); i<(ll)(n); i++)
#define RREP(i, n) for (ll i=(ll)(n); i>(ll)0; i--)
#define RREPS(i, s, n) for (ll i=(ll)(n); i>(ll)(s); i--)
#define ALL(c) std::begin((c)), std::end((c))
struct io {io() {cin.tie(0); ios::sync_with_stdio(0);} } caller;

int main(){
    int n;
    cin >> n;

    V<int> a(n), b(n);
    REP (i, n) cin >> a[i];
    REP (i, n) cin >> b[i];

    V<int> order_a(n), order_b(n);
    iota(ALL(order_a), 0), iota(ALL(order_b), 0);

    int win = 0, cnt = 0;
    do{
        do{
            int pa = 0;
            REP (i, n){
                if (a[order_a[i]] > b[order_b[i]]) pa++;
            }

            cnt++;
            if (2 * pa > n) win++;

        }while (next_permutation(ALL(order_a)));
    }while (next_permutation(ALL(order_b)));

    cout << (long double)win / cnt << endl;
    
    return 0;
}
0