結果
| 問題 | No.133 カードゲーム | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2020-03-20 14:32:51 | 
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                WA
                                 
                             | 
| 実行時間 | - | 
| コード長 | 736 bytes | 
| コンパイル時間 | 1,767 ms | 
| コンパイル使用メモリ | 170,664 KB | 
| 実行使用メモリ | 6,824 KB | 
| 最終ジャッジ日時 | 2024-12-14 04:10:56 | 
| 合計ジャッジ時間 | 2,328 ms | 
| ジャッジサーバーID (参考情報) | judge2 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 WA * 1 | 
| other | AC * 13 WA * 6 | 
ソースコード
#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;
}
            
            
            
        