結果

問題 No.133 カードゲーム
ユーザー h4relh4rel
提出日時 2023-05-26 10:45:05
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 940 bytes
コンパイル時間 1,591 ms
コンパイル使用メモリ 169,628 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-26 05:24:16
合計ジャッジ時間 2,748 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define all(a) a.begin(),a.end()
#define reps(i, a, n) for (int i = (a); i < (int)(n); i++)
#define rep(i, n) reps(i, 0, n)
#define rreps(i, a, n) for (int i = (a); i > (int)(n); i--)
const long long mod = 1000000007;
const long long INF = 1e18;

int main() {
  int n;
  cin >> n;
  vector<int> a (n);
  vector<int> b (n);
  rep(i,n) {
    cin >> a[i];
  }
  rep(i,n) {
    cin >> b[i];
  }
  sort(all(a));
  sort(all(b));
  int aw = 0;
  int bw = 0;
  int ac,bc;
  do {
    do {
      ac = 0;
      bc = 0;
      rep(i,n) {
        if (a[i] > b[i]) {
          ac++;
        }
        else {
          bc++;
        }
      }
      if (ac > bc) {
        aw++;
      }
      else {
        bw++;
      }
    } while (next_permutation(all(a)));
  } while (next_permutation(all(b)));
  cout << fixed << setprecision(8);
  cout << aw / (double)(aw+bw) << endl;
  return 0;
}
0