結果

問題 No.133 カードゲーム
ユーザー Kosuke FutamataKosuke Futamata
提出日時 2023-03-02 07:02:40
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 1,340 bytes
コンパイル時間 2,129 ms
コンパイル使用メモリ 206,776 KB
実行使用メモリ 4,372 KB
最終ジャッジ日時 2023-10-17 05:34:23
合計ジャッジ時間 2,653 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>

#define ALL(a) begin(a), end(a)
#define REP(i, n) for (int i = 0; i < static_cast<int>(n); ++i)

using ll = long long;
using ld = long double;
using byte = unsigned char;
using int128_t = __int128_t;
using uint128_t = __uint128_t;
using namespace std;

constexpr int IINF = 1e9 + 1;
constexpr ll LINF = 1e18 + 1;

// ================ Comment ================
// 
// =========================================

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

    sort(ALL(A));
    sort(ALL(B));

    auto n_game_Awin = 0;
    auto n_games = 0;
    do {
        do {
            auto n_turn_Awin = 0;
            auto n_turn_Bwin = 0; 
            for (auto i = 0; N > i; i++) {
                if (A[i] > B[i]) {
                    n_turn_Awin++;
                }
                else {
                    n_turn_Bwin++;
                }
            }
            if (n_turn_Awin > n_turn_Bwin) {
                n_game_Awin++;
            }
            n_games++;
        } while (next_permutation(ALL(B)));
    } while (next_permutation(ALL(A)));

    cout << setprecision(15) << (double)n_game_Awin / n_games << endl;
    return EXIT_SUCCESS;
}
0