結果

問題 No.133 カードゲーム
ユーザー chocopuuchocopuu
提出日時 2018-07-13 21:00:41
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 822 bytes
コンパイル時間 740 ms
コンパイル使用メモリ 70,548 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-17 11:04:08
合計ジャッジ時間 1,534 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include<iostream>
#include<cstring>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
using namespace std;
#define rep(i,s,n) for(int i = s;i<n;i++)
#define repe(i,s,n) for(int i = s;i<=n;i++)
#define pb push_back
typedef long long ll;
static const ll maxLL = (ll)1 << 62;

int main(){
    int n;
    cin>>n;
    vector<int> a,b;
    rep(i,0,n){
        int c;
        cin>>c;
        a.pb(c);
    }
    rep(i,0,n){
        int c;
        cin>>c;
        b.pb(c);
    }
    sort(a.begin(),a.end());
    int all=0;
    int win=0;
    do{
        int c=0;
        rep(i,0,n){
            if(a[i]>b[i]){
                c++;
            }
        }
        all++;
        if(c>n-c){
            win++;
        }
    }while(next_permutation(a.begin(),a.end()));
    cout<<1.*win/all<<endl;
    return 0;
}
0