結果

問題 No.133 カードゲーム
ユーザー n0ma_run0ma_ru
提出日時 2023-12-16 00:02:51
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 1,147 bytes
コンパイル時間 2,065 ms
コンパイル使用メモリ 207,840 KB
実行使用メモリ 6,676 KB
最終ジャッジ日時 2023-12-16 00:02:55
合計ジャッジ時間 3,281 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define ALL(v) v.begin(),v.end()
#define debug(x) cerr << #x << ": " << x << endl;
const ll MOD = 1e9+7;
const ll INF = 1LL << 60;
void Yes(bool flag) { cout << (flag ? "Yes" : "No") << endl; }
using pii = pair<int, int>;
template<class F, class S>
ostream& operator << (ostream& os, pair<F,S> p) {
    return os << '(' << p.first << ',' << p.second << ')';
}
template<class Iter>
void print(Iter beg, Iter end) {
    for (Iter itr = beg; itr != end; ++itr) {
        cerr << *itr << ' ';
    }
    cerr << endl;
}

int N;
vector<int> A,B;

int main() {
    cin >> N;
    A.resize(N);
    B.resize(N);
    for (auto& a : A) cin >> a;
    for (auto& b : B) cin >> b;
    sort(ALL(A));
    sort(ALL(B));

    int all = 0, win = 0;
    do {
        do {
            ++all;
            int cnt = 0;
            for (int i = 0; i < N; ++i) {
                if (A[i] > B[i]) ++cnt;
            }
            if (cnt > N / 2) ++win;
        } while (next_permutation(ALL(B)));
    } while (next_permutation(ALL(A)));
    cout << fixed << setprecision(6) << (double)win / all << endl;
}
0