結果
問題 | No.133 カードゲーム |
ユーザー |
|
提出日時 | 2020-11-21 02:55:35 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 707 bytes |
コンパイル時間 | 2,585 ms |
コンパイル使用メモリ | 197,984 KB |
最終ジャッジ日時 | 2025-01-16 03:47:12 |
ジャッジサーバーID (参考情報) |
judge5 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 19 |
ソースコード
#include <bits/stdc++.h>using namespace std;void potato() {int n;cin >> n;vector<double> a(n), b(n);for(auto& x : a) cin >> x;for(auto& x : b) cin >> x;sort(a.begin(), a.end());sort(b.begin(), b.end());double wins = 0, rounds = 0;do {do {int aw = 0, bw = 0;for(int i = 0; i < n; i++) {if(a[i] > b[i]) aw++;else bw++;}if(aw > bw) wins++;rounds++;} while(next_permutation(b.begin(), b.end()));} while(next_permutation(a.begin(), a.end()));double ans = wins / rounds;printf("%.6lf\n", ans);}signed main() {ios::sync_with_stdio(false);cin.tie(0);int tt=1;while(tt--) potato();return 0;}