結果

問題 No.133 カードゲーム
ユーザー stone_725
提出日時 2019-08-16 17:59:33
言語 C++17(clang)
(17.0.6 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 671 bytes
コンパイル時間 917 ms
コンパイル使用メモリ 130,588 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-30 14:31:21
合計ジャッジ時間 1,607 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 19
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main(){
    int n;
    cin >> n;
    vector<int> a(n), b(n);
    for(auto&& i : a){
        cin >> i;
    }
    for(auto&& i : b){
        cin >> i;
    }
    sort(begin(a), end(a));
    sort(begin(b), end(b));
    int cnt = 0;
    double ans = 0;
    do{
        do{
            cnt++;
            int win = 0;
            for(int i = 0; i < n; i++){
                win += b[i] < a[i];
            }
            ans += n < win * 2;
        }while(next_permutation(begin(b), end(b)));
    }while(next_permutation(begin(a), end(a)));
    ans /= cnt;
    cout << fixed << ans << "\n";
}
0