結果

問題 No.133 カードゲーム
ユーザー shinohara_issp
提出日時 2021-05-27 22:57:41
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 1,019 bytes
コンパイル時間 1,963 ms
コンパイル使用メモリ 173,332 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-06 16:46:14
合計ジャッジ時間 2,827 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 19
権限があれば一括ダウンロードができます

ソースコード

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