結果
問題 | No.133 カードゲーム |
ユーザー |
|
提出日時 | 2023-10-05 16:23:51 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 813 bytes |
コンパイル時間 | 1,857 ms |
コンパイル使用メモリ | 199,368 KB |
最終ジャッジ日時 | 2025-02-17 04:26:12 |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 19 |
ソースコード
#include <bits/stdc++.h>//#include <atcoder/all>using namespace std;//using namespace atcoder;const static int NIL = -1;const long long INF = 1LL << 60;typedef long long ll;typedef unsigned long long ull;bool is_debug = false;int ini = 1000000001;ull mod = 1000000007;int main(){int n;cin >> n;vector<int> a(n);vector<int> 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());sort(b.begin(), b.end());int all = 0;int win = 0;do{do{all++;int cnt = 0;for(int i = 0; i < n; i++){if(a[i] > b[i])cnt++;}if(cnt * 2 > n)win++;}while(next_permutation(b.begin(), b.end()));}while(next_permutation(a.begin(), a.end()));cout << setprecision(10) << (double)win / all << endl;}