結果
| 問題 |
No.133 カードゲーム
|
| コンテスト | |
| ユーザー |
ant2357
|
| 提出日時 | 2017-08-23 22:10:28 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 25 ms / 5,000 ms |
| コード長 | 575 bytes |
| コンパイル時間 | 2,473 ms |
| コンパイル使用メモリ | 197,304 KB |
| 最終ジャッジ日時 | 2025-01-05 02:26:00 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 19 |
ソースコード
#include "bits/stdc++.h"
using namespace std;
int main() {
int n;
cin >> n;
vector<int> a(n);
for (int i = 0; i < n; i++) {
cin >> a[i];
}
vector<int> b(n);
for (int i = 0; i < n; i++) {
cin >> b[i];
}
sort(a.begin(), a.end());
int win = 0, count = 0;
do {
int aWin = 0, bWin = 0;
for (int i = 0; i < n; i++) {
if (a[i] > b[i]) {
aWin++;
} else {
bWin++;
}
}
if (aWin > bWin) {
win++;
}
count++;
} while (next_permutation(a.begin(), a.end()));
double res = (double)win / count;
printf("%.10lf\n", res);
return 0;
}
ant2357