結果

問題 No.133 カードゲーム
ユーザー nemakura3nemakura3
提出日時 2019-09-11 21:33:56
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 830 bytes
コンパイル時間 1,466 ms
コンパイル使用メモリ 168,716 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-15 13:57:32
合計ジャッジ時間 2,414 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>
#define FOR(i,a,b) for (int (i) = (a); (i) < (b); ++(i))
#define rep(i,n) for (int (i) = 0; (i) < (n); ++(i))
#define rrep(i,n) for (int (i) = (n); (i) >= 0; --(i))
#define all(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;
const int INF = 1e9;
const ll LINF = 1LL << 60;
const ll MOD = 1e9 + 7;

int N, A[4], B[4];

int main() {
    cin >> N;
    rep(i,N) cin >> A[i];
    rep(i,N) cin >> B[i];
    sort(A, A+N);
    sort(B, B+N);
    int awin = 0;
    int ap = 0;
    do {
        do {
            ++ap;
            rep(i,N) {
                if (A[i] > B[i]) ++awin;
            }
        } while (next_permutation(B, B+N));
    } while (next_permutation(A, A+N));
    double p = (double)awin / (double)ap - 1.0;
    cout << fixed << setprecision(10) << p << "\n";
    return 0;
}
0