結果
| 問題 |
No.133 カードゲーム
|
| コンテスト | |
| ユーザー |
strawhare_eng
|
| 提出日時 | 2020-04-23 21:03:29 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 1,013 bytes |
| コンパイル時間 | 1,856 ms |
| コンパイル使用メモリ | 171,484 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-10-13 21:34:36 |
| 合計ジャッジ時間 | 2,840 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 19 |
ソースコード
#include <bits/stdc++.h>
#define _USE_MATH_DEFINES
#include <math.h>
#include <algorithm>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define print(s) cout << s << endl
#define acc(v) accumulate(v.begin(), v.end(), 0)
using namespace std;
typedef long long ll;
const int INF = 1e9;
const ll LINF = 1e18;
const ll MOD = 1e9 + 7;
typedef pair<int, int> pii;
typedef vector<int> vint;
typedef vector<string> vstr;
typedef vector<char> vchar;
int main()
{
int n;
cin >> n;
vector<int> a(n), b(n);
rep(i,n){
cin >> a[i];
}
rep(i,n){
cin >> b[i];
}
sort(all(a));
double Ans = 0;
int Count = 0;
do
{
Count++;
sort(all(b));
int count = 0;
double ans = 0;
do
{
int win = 0;
count++;
rep(i, n)
{
if (a[i] > b[i])
win++;
}
ans += win > n / 2 ? 1 : 0;
} while (next_permutation(all(b)));
Ans += 1.0 * ans / count;
} while (next_permutation(all(a)));
cout << 1.0 * Ans / Count << endl;
}
strawhare_eng