結果
問題 | No.133 カードゲーム |
ユーザー |
|
提出日時 | 2021-10-09 18:43:36 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 527 bytes |
コンパイル時間 | 2,363 ms |
コンパイル使用メモリ | 197,632 KB |
最終ジャッジ日時 | 2025-01-24 23:55:28 |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 19 |
ソースコード
#include <bits/stdc++.h>using namespace std;int n;double p = 0;int main(){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(b.begin(), b.end());do {int k = 0, i = 0;for (vector<int>::iterator itr = b.begin(); itr != b.end(); itr++) {if (a[i] > *itr)k++;i++;}if (k > n / 2)p++;} while (next_permutation(b.begin(), b.end()));for (int i = 1; i <= n; i++)p /= (double)i;cout << p << endl;}