結果

問題 No.133 カードゲーム
ユーザー gojira_kugojira_ku
提出日時 2018-11-14 16:40:48
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 1,286 bytes
コンパイル時間 561 ms
コンパイル使用メモリ 75,724 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-26 01:07:51
合計ジャッジ時間 1,784 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<string>
#include<string.h>
#include<math.h>
#include<stdlib.h>
#include<vector>
#include<queue>
#include<map>
#define rep(index,num) for(int index=0;index<num;index++)
#define rep1(index,num) for(int index=1;index<=num;index++)
#define scan(argument) cin>>argument
#define prin(argument) cout<<argument<<endl
#define kaigyo cout<<endl
#define eps 1e-15
#define mp(a1,a2) make_pair(a1,a2)
typedef long long ll;
using namespace std;
typedef pair<ll,ll> pll;
typedef pair<int,int> pint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<pint> vpint;
typedef vector<pll> vpll;
ll INFl=1e+18+1;
int INF=1e+9+1;
int kaijo(int m){
	int ans=1;
	rep1(i,m){
		ans*=i;
	}
	return ans;
}
int main(){
	//https://yukicoder.me/problems/199
	int N;
	int A[4],B[4];
	scan(N);
	rep(i,N) scan(A[i]);
	rep(i,N) scan(B[i]);
	int siai=kaijo(N)*kaijo(N);
	int Awinnum=0;
	vint Ajun;
	rep(i,N) Ajun.push_back(i);
	do{
		vint Bjun;
		rep(i,N) Bjun.push_back(i);
		do{
			int Awin=0;
			rep(i,N){
				if(A[Ajun[i]]>B[Bjun[i]]) Awin++;
			}
			if(Awin>N/2) Awinnum++;
		}while(next_permutation(Bjun.begin(),Bjun.end()));
	}while(next_permutation(Ajun.begin(),Ajun.end()));
	double ans=(double)Awinnum/siai;
	prin(ans);
	return 0;
}
0