結果

問題 No.133 カードゲーム
ユーザー wj247890wj247890
提出日時 2022-12-13 10:14:04
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 1,394 bytes
コンパイル時間 1,991 ms
コンパイル使用メモリ 169,220 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-24 21:11:51
合計ジャッジ時間 2,975 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 2 ms
5,376 KB
testcase_10 AC 2 ms
5,376 KB
testcase_11 AC 2 ms
5,376 KB
testcase_12 AC 2 ms
5,376 KB
testcase_13 AC 2 ms
5,376 KB
testcase_14 AC 2 ms
5,376 KB
testcase_15 AC 2 ms
5,376 KB
testcase_16 AC 2 ms
5,376 KB
testcase_17 AC 2 ms
5,376 KB
testcase_18 AC 2 ms
5,376 KB
testcase_19 AC 2 ms
5,376 KB
testcase_20 AC 2 ms
5,376 KB
testcase_21 AC 2 ms
5,376 KB
testcase_22 AC 2 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

using pii = pair<int, int>;
template<class T> using v = vector<T>;
template<class T> using vv = v<v<T>>;
#define pb push_back
#define pob pop_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define mt make_tuple
#define p_queue priority_queue
#define rev reverse
#define sz(x) (int)(x).size()
#define reps(i, m, n) for (int i = m; i < (int)(n); i++)
#define rreps(i, m, n) for (int i = m-1; i >= (int)(n); i--)
#define rep(i, n) reps(i, 0, n)
#define rrep(i, n) rreps(i, n, 0)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define alls(v, l, r) v.begin()+ l, v.begin()+ r
#define ralls(v, l, r) v.rbegin() + l, v.rbegin() + r
#define fix(n) fixed << setprecision(n)
#define pcnt(i) __builtin_popcountll((ll)i)
const int MOD = 1000000007;
v<int> dy = {0, 1, 0, -1}, dx = {1, 0, -1, 0};


int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n; cin >> n;
  v<int> a(n), b(n);
  rep(i, n) cin >> a[i];
  rep(i, n) cin >> b[i];

  int bunbo = 0;

  double bunsi = 0;
  sort(all(a));
  sort(all(b));
  do {
     do {
      
      int cnt = 0;
      rep(i, n) if (a[i] > b[i]) cnt++;
      if (cnt >= (n+2)/2) bunsi++;
      bunbo++;

    } while (next_permutation(all(b)));
  } while (next_permutation(all(a)));

  double ans = bunsi / bunbo;
  cout << ans << endl;
  return 0;
}
0