結果

問題 No.133 カードゲーム
ユーザー ugis_progugis_prog
提出日時 2018-08-29 13:26:24
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 1,009 bytes
コンパイル時間 1,400 ms
コンパイル使用メモリ 149,388 KB
実行使用メモリ 4,352 KB
最終ジャッジ日時 2023-10-11 14:59:08
合計ジャッジ時間 2,894 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
const int MOD = 1e9+7;
const int INF = 1e9;
const ll INFll = 1e18;
#define put(n) cout<<(n)<<endl
#define Cout(n) cout<<(n)
#define rep(i,num,N) for(int(i)=(num);(i)<(N);++(i))
#define rrep(i,num,N) for(int (i)=(num);(i)>(N);--(i))
#define all(v) (v).begin() , (v).end()
#define rall(v) (v).rbegin() , (v).rend()
#define MP make_pair
#define pb(q) push_back(q)
int dx[4] = {0,0,1,-1};
int dy[4] = {1,-1,0,0};


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int N;
    cin>>N;
    vector<int> A(N);
    vector<int> B(N);

    rep(i,0,N) cin>>A[i];
    rep(i,0,N) cin>>B[i];

    sort(all(A));
    sort(all(B));

    double cnt = 0.0;
    double ans = 0.0;
    
    do{
        int win = 0;
        rep(i,0,N){
            if(A[i] > B[i]) ++win;
        }
        if(win >= N/2+1) ans += 1.0;
        cnt += 1.0;
        
    }while(next_permutation(all(A)));

    cout << fixed << setprecision(10) << ans/cnt << endl;
}
0