結果
| 問題 | No.133 カードゲーム |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-05-30 19:19:59 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.90.0) |
| 結果 |
AC
|
| 実行時間 | 1 ms / 5,000 ms |
| コード長 | 1,103 bytes |
| 記録 | |
| コンパイル時間 | 1,270 ms |
| コンパイル使用メモリ | 216,832 KB |
| 実行使用メモリ | 6,400 KB |
| 最終ジャッジ日時 | 2026-06-20 17:11:58 |
| 合計ジャッジ時間 | 2,437 ms |
|
ジャッジサーバーID (参考情報) |
judge1_1 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 19 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main(void)
{
cin.tie(0);
ios::sync_with_stdio(false);
int n, t;
vector <int> a, b;
cin >> n;
for (int i = 0; i < n; i++)
{
cin >> t;
a.push_back(t);
}
for (int i = 0; i < n; i++)
{
cin >> t;
b.push_back(t);
}
double total = 0;
double res = 0;
sort(a.begin(), a.end());
do
{
sort(b.begin(), b.end());
do
{
int scoreA = 0;
int scoreB = 0;
for (int i = 0; i < n; i++)
{
if (a[i] > b[i])
{
scoreA++;
}
else
{
scoreB++;
}
}
if (scoreA > scoreB)
{
res++;
}
total++;
} while (next_permutation(b.begin(), b.end()));
} while (next_permutation(a.begin(), a.end()));
cout << fixed;
cout.precision(9);
cout << (res / total) << '\n';
return 0;
}