結果

問題 No.133 カードゲーム
ユーザー shinohara_isspshinohara_issp
提出日時 2021-05-27 22:57:41
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 1,019 bytes
コンパイル時間 1,937 ms
コンパイル使用メモリ 171,700 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-24 09:21:52
合計ジャッジ時間 2,343 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 1 ms
5,376 KB
testcase_02 AC 1 ms
5,376 KB
testcase_03 AC 1 ms
5,376 KB
testcase_04 AC 1 ms
5,376 KB
testcase_05 AC 1 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 1 ms
5,376 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 2 ms
5,376 KB
testcase_10 AC 1 ms
5,376 KB
testcase_11 AC 1 ms
5,376 KB
testcase_12 AC 1 ms
5,376 KB
testcase_13 AC 1 ms
5,376 KB
testcase_14 AC 2 ms
5,376 KB
testcase_15 AC 2 ms
5,376 KB
testcase_16 AC 2 ms
5,376 KB
testcase_17 AC 2 ms
5,376 KB
testcase_18 AC 1 ms
5,376 KB
testcase_19 AC 1 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 <bits/stdc++.h>
using namespace std;
using ll = int64_t;
using Vll =vector<ll>;
using VVll =vector<vector<ll>>;
template <class T>
using Vc = vector<T>;
template <class T>
using VVc = vector<vector<T>>;

void Z(ll i){ cout<<"Test"<<i<<endl; }



int main(){
    ll n,a,b;
    cin>>n;
    Vll A(n),B(n);

    for(ll i=0;i<n;i++){
        cin>>a;
        A.at(i)=a;

    }

    for(ll i=0;i<n;i++){
        cin>>a;
        B.at(i)=a;
        
    }




    ll aw=0,bw=0,nw=0;


    sort(A.begin(),A.end());
    sort(B.begin(),B.end());


    

    do{

        Vll B_=B;
        
        do{
            ll ap=0,bp=0;

            for(ll i=0;i<n;i++){
                if(A.at(i)>B_.at(i)) ap++;
                else bp++;

            }

            if(ap>bp) aw++;
            else if(ap<bp) bw++;
            else nw++;

        }while(next_permutation(B_.begin(),B_.end()));

    }while(next_permutation(A.begin(),A.end()));


    double ans;

    ans=(double)(aw)/(aw+bw+nw);

    cout<<ans<<endl;









}
0