結果

問題 No.133 カードゲーム
ユーザー hibikusanhibikusan
提出日時 2018-03-25 10:53:45
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 1,333 bytes
コンパイル時間 1,203 ms
コンパイル使用メモリ 104,608 KB
実行使用メモリ 4,388 KB
最終ジャッジ日時 2023-09-07 11:20:49
合計ジャッジ時間 2,366 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <functional>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vec;
typedef pair<int, int> P;
#define rep(n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define in(a) cin >> a;
#define out(a) cout << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
#define INF 100000000
int dy[] = { 1,0,-1,0 }, dx[] = { 0,1,0,-1 };



int main() {
	int n;
	cin >> n;
	vector<int>a(n);
	vector<int>b(n);
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	for (int i = 0; i < n; i++) {
		cin >> b[i];
	}
	sort(a.begin(), a.end());
	sort(b.begin(), b.end());
	double bb = 0, bs = 0;
	do {
		do {
			bb++;
			int cnt = 0;
			for (int i = 0; i < n; i++) {
				if (a[i] > b[i]) cnt++;
			}
			if (cnt > n - cnt) bs++;
		} while (next_permutation(b.begin(), b.end()));
	} while (next_permutation(a.begin(), a.end()));
	printf("%.10f\n", bs / bb);
	return 0;
}
0