結果

問題 No.133 カードゲーム
ユーザー f1b_maxbl00df1b_maxbl00d
提出日時 2019-12-16 05:57:40
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 1,529 bytes
コンパイル時間 1,302 ms
コンパイル使用メモリ 128,916 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-15 16:51:30
合計ジャッジ時間 2,500 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <iostream>
#include <vector>
#include <limits.h>
#include <algorithm>
#include <string>
#include <math.h>
#include <limits.h>
#include <queue>
#include <map>
#include <set>
#include <iomanip>
#include <bitset>
#include <cassert>
#include <random>
#include <functional>
#include <stack>
#include <iomanip>
#include <cassert>
//#include <boost/multiprecision/cpp_int.hpp>
#include <complex>
#include <cstdio>
#include <list>
#include <bitset>

//< in.txt > out.txt
using namespace std;
//std::ios::sync_with_stdio(false);
//std::cin.tie(0);
const long long MOD = 1e9 + 7;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef pair<ld, ll> pdl;
typedef pair<ld, ld> pdd;
typedef vector<ll> VLL;
typedef vector<VLL> VVLL;
//typedef boost::multiprecision::cpp_int bigint;

int main() {
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);
	ll N;
	cin >> N;
	VLL A(N);
	VLL B(N);
	for (ll n = 0; n < N; n++)cin >> A[n];
	for (ll n = 0; n < N; n++)cin >> B[n];
	VLL VA(N);
	for (ll n = 0; n < N; n++)VA[n] = n;
	ll ans = 0;
	do {
		VLL VB(N);
		for (ll n = 0; n < N; n++)VB[n] = n;
		do {
			ll a = 0;
			ll b = 0;
			for (ll n = 0; n < N; n++) {
				if (A[VA[n]] > B[VB[n]])a++;
				else if (A[VA[n]] < B[VB[n]])b++;
				else {
					a++;
					b++;
				}
			}
			if (a > b)ans++;
		} while (next_permutation(VB.begin(), VB.end()));
	} while (next_permutation(VA.begin(), VA.end()));
	ll M = 1;
	for (ll n = N; n >= 1; n--)M *= n;
	M *= M;
	cout << setprecision(12) << (ld)ans / M << "\n";
	return 0;
}
0