結果
| 問題 |
No.133 カードゲーム
|
| コンテスト | |
| ユーザー |
n0ma_ru
|
| 提出日時 | 2023-12-16 00:02:51 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 1,147 bytes |
| コンパイル時間 | 2,211 ms |
| コンパイル使用メモリ | 198,268 KB |
| 最終ジャッジ日時 | 2025-02-18 11:37:40 |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 19 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define ALL(v) v.begin(),v.end()
#define debug(x) cerr << #x << ": " << x << endl;
const ll MOD = 1e9+7;
const ll INF = 1LL << 60;
void Yes(bool flag) { cout << (flag ? "Yes" : "No") << endl; }
using pii = pair<int, int>;
template<class F, class S>
ostream& operator << (ostream& os, pair<F,S> p) {
return os << '(' << p.first << ',' << p.second << ')';
}
template<class Iter>
void print(Iter beg, Iter end) {
for (Iter itr = beg; itr != end; ++itr) {
cerr << *itr << ' ';
}
cerr << endl;
}
int N;
vector<int> A,B;
int main() {
cin >> N;
A.resize(N);
B.resize(N);
for (auto& a : A) cin >> a;
for (auto& b : B) cin >> b;
sort(ALL(A));
sort(ALL(B));
int all = 0, win = 0;
do {
do {
++all;
int cnt = 0;
for (int i = 0; i < N; ++i) {
if (A[i] > B[i]) ++cnt;
}
if (cnt > N / 2) ++win;
} while (next_permutation(ALL(B)));
} while (next_permutation(ALL(A)));
cout << fixed << setprecision(6) << (double)win / all << endl;
}
n0ma_ru