結果
| 問題 |
No.133 カードゲーム
|
| コンテスト | |
| ユーザー |
Tatsu_mr
|
| 提出日時 | 2024-11-19 18:02:23 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 1,172 bytes |
| コンパイル時間 | 3,428 ms |
| コンパイル使用メモリ | 247,804 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-19 18:02:55 |
| 合計ジャッジ時間 | 4,051 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 19 |
ソースコード
#include <bits/stdc++.h>
#define For(i, a, b) for(int i = a; i < b; i++)
#define rep(i, n) For(i, 0, n)
#define rFor(i, a, b) for(int i = a; i >= b; i--)
#define ALL(v) (v).begin(), (v).end()
#define rALL(v) (v).rbegin(), (v).rend()
using namespace std;
using lint = long long;
using ld = long double;
int INF = 2000000000;
lint LINF = 1000000000000000000;
int main() {
int n;
cin >> n;
vector<int> a(n);
rep(i, n) {
cin >> a[i];
}
vector<int> b(n);
rep(i, n) {
cin >> b[i];
}
vector<int> x(n);
rep(i, n) {
x[i] = i;
}
ld all = 0, win = 0;
do {
vector<int> y(n);
rep(i, n) {
y[i] = i;
}
do {
all++;
int ca = 0, cb = 0;
rep(i, n) {
if (a[x[i]] > b[y[i]]) {
ca++;
} else if (a[x[i]] < b[y[i]]) {
cb++;
}
}
if (ca > cb) {
win++;
}
} while (next_permutation(ALL(y)));
} while (next_permutation(ALL(x)));
cout << fixed << setprecision(10) << win / all << endl;
}
Tatsu_mr