結果

問題 No.133 カードゲーム
ユーザー TerunobuInabaTerunobuInaba
提出日時 2020-03-20 14:32:51
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 736 bytes
コンパイル時間 1,370 ms
コンパイル使用メモリ 169,372 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-05-08 03:58:20
合計ジャッジ時間 2,054 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main () {
    int N;
    cin >> N;
    vector<int> A(N), B(N);
    for (int i = 0; i < N; i++) {
        cin >> A[i];
    }
    for (int i = 0; i < N; i++) {
        cin >> B[i];
    }

    double game = 0;
    double wins = 0;

    do {
        do {
            ll num = 0;
            for (int i = 0; i < N; i++) {
                if (A[i] > B[i]) num ++;
            }
            game ++;
            if (num > N/2) wins ++; 
        } while(next_permutation(B.begin(), B.end()));
    } while(next_permutation(A.begin(), A.end()));

    long double ans = wins;

    ans /= game;

    cout << fixed << setprecision(10);
    cout << ans << endl;
    return 0;
}
0