結果
問題 | No.133 カードゲーム |
ユーザー |
|
提出日時 | 2024-08-29 15:22:00 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 897 bytes |
コンパイル時間 | 12,495 ms |
コンパイル使用メモリ | 337,612 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-08-29 15:22:14 |
合計ジャッジ時間 | 7,242 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 19 |
ソースコード
#include <bits/stdc++.h>#include <atcoder/all>#include <unordered_set>#include <functional>using namespace std;using namespace atcoder;using ll = long long;using P = pair<int, int>;#define rep(i, n) for (int i = 0; i < (n); i++)//void chmin(ll & a, ll b) { a = min(a, b); }using mint = modint998244353;bool num[100000000];int main() {int n;cin >> n;vector<int> a(n), b(n);rep(i, n) cin >> a[i];rep(i, n) cin >> b[i];sort(a.begin(), a.end());sort(b.begin(), b.end());int al = 0;int win = 0;do {do {int cnta = 0;int cntb = 0;rep(i, n) {if (a[i] > b[i]) {cnta++;}else if (a[i] == b[i]) {}else {cntb++;}}if (cnta > cntb) {win++;}al++;} while (next_permutation(b.begin(), b.end()));} while (next_permutation(a.begin(), a.end()));double ans = double(win)/al;cout << ans << endl;}