結果
問題 | No.133 カードゲーム |
ユーザー |
![]() |
提出日時 | 2020-02-14 14:37:56 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 597 bytes |
コンパイル時間 | 723 ms |
コンパイル使用メモリ | 76,784 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-10-06 07:55:14 |
合計ジャッジ時間 | 1,413 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 19 |
ソースコード
#include <iostream>#include <vector>#include <algorithm>using namespace std;int main() {int n;cin >> n;vector<int> a(n), 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());double ret = 0;do {int now = 0;for (int i = 0; i < n; i++) {if (a[i] > b[i])now++;}if (now > n - now)ret++;} while (next_permutation(a.begin(), a.end()));double fact = 1;for (int i = 1; i <= n; i++)fact *= i;cout << ret / fact << endl;return 0;}