結果

問題 No.133 カードゲーム
ユーザー furafura
提出日時 2020-04-20 12:31:13
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 3 ms / 5,000 ms
コード長 491 bytes
コンパイル時間 2,541 ms
コンパイル使用メモリ 196,836 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-16 00:34:33
合計ジャッジ時間 3,370 ms
ジャッジサーバーID
(参考情報)
judge1 / 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 2 ms
5,376 KB
testcase_17 AC 2 ms
5,376 KB
testcase_18 AC 2 ms
5,376 KB
testcase_19 AC 3 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>

#define rep(i,n) for(int i=0;i<(n);i++)

using namespace std;

int main(){
	int n; scanf("%d",&n);
	int a[4],b[4];
	rep(i,n) scanf("%d",&a[i]);
	rep(i,n) scanf("%d",&b[i]);

	sort(a,a+n);
	sort(b,b+n);

	int cnt1=0,cnt2=0;
	do{
		do{
			int tmp=0;
			rep(i,n){
				if(a[i]>b[i]) tmp++;
				else          tmp--;
			}
			if(tmp>0) cnt1++;
			cnt2++;
		}while(next_permutation(b,b+n));
	}while(next_permutation(a,a+n));

	printf("%.9f\n",1.0*cnt1/cnt2);

	return 0;
}
0