結果

問題 No.133 カードゲーム
ユーザー moricupmoricup
提出日時 2020-09-24 00:11:37
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 1,440 bytes
コンパイル時間 3,071 ms
コンパイル使用メモリ 167,784 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-10 13:13:54
合計ジャッジ時間 2,903 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;

//typedef
typedef unsigned int UINT;
typedef unsigned long long ULL;
typedef long long LL;
typedef pair<long long, long long> PLL;
typedef tuple<long long, long long, long long> TLL3;
typedef tuple<long long, long long, long long, long long> TLL4;
typedef set<LL, greater<LL> > setdownLL;
#define PQ priority_queue
typedef PQ<LL, vector<LL>, greater<LL> > pqupLL;
//container utill
#define ALL(v) (v).begin(),(v).end()
#define CR [](auto element1, auto element2){return element1>element2;}
#define LB lower_bound
#define UP upper_bound
#define PB push_back
#define MP make_pair
#define MT make_tuple
//constant
#define PI 3.141592653589793

int main(){
    //input
    int N;
    cin >> N;
    int A[N], B[N];
    int i;
    for(i=0; i<N; i++){
        cin >> A[i];
    }
    for(i=0; i<N; i++){
        cin >> B[i];
    }

    //calc
    sort(A,A+N);
    sort(B,B+N);
    int Awon=0, shobusu=0;
    int Awonsho, Bwonsho;
    do{
        do{
            Awonsho=0, Bwonsho=0;
            for(i=0; i<N; i++){
                if(A[i]>B[i]) Awonsho++;
                else if(A[i]<B[i]) Bwonsho++;
            }
            if(Awonsho>Bwonsho) Awon++;
            shobusu++;
        }while(next_permutation(B,B+N));
    }while(next_permutation(A,A+N));
    long double  Awonlb=Awon, shobusulb=shobusu;

    //output
    cout << fixed << setprecision(5) << Awonlb/shobusulb << endl;
    return 0;
}
0