結果

問題 No.133 カードゲーム
ユーザー tack_atack_a
提出日時 2023-03-18 17:57:25
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 574 bytes
コンパイル時間 1,538 ms
コンパイル使用メモリ 169,788 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-18 17:26:16
合計ジャッジ時間 2,940 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

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

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

    vector<int> a(N), b(N), perm(N);
    for (int i = 0; i < N; i++) cin >> a[i];
    for (int i = 0; i < N; i++) cin >> b[i];
    for (int i = 0; i < N; i++) perm[i] = i;

    int ptn =0, awin = 0;
    int cnt;
    do {
        ptn++;
        cnt = 0;
        for (int i = 0; i < N; i++) {
            if (a[i] > b[i]) cnt++;
        }
        if (cnt > N / 2) awin++;
    } while (next_permutation(a.begin(), a.end()));
    double ans = (double) awin / ptn;
    printf("%.2f\n", ans);

}
0