結果
| 問題 |
No.133 カードゲーム
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-12-06 16:23:41 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 923 bytes |
| コンパイル時間 | 1,907 ms |
| コンパイル使用メモリ | 198,660 KB |
| 最終ジャッジ日時 | 2025-01-06 18:25:26 |
|
ジャッジサーバーID (参考情報) |
judge2 / judge6 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 19 |
ソースコード
#include <bits/stdc++.h>
#define err(args...) {}
#ifdef DEBUG
#include "_debug.cpp"
#endif
using namespace std;
using ll = long long;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
int n;
cin >> n;
vector<int> a(n), b(n);
for(int i = 0; i < n; i++) {
cin >> a[i];
}
for(int i = 0; i < n; i++) {
cin >> b[i];
}
sort(a.begin(), a.end());
int win = 0, games = 0;
do {
sort(b.begin(), b.end());
do {
int a_score = 0, b_score = 0;
for(int i = 0; i < n; i++) {
a_score += a[i] > b[i];
b_score += b[i] > a[i];
}
win += a_score > b_score;
games++;
} while(next_permutation(b.begin(), b.end()));
} while(next_permutation(a.begin(), a.end()));
cout << double(win) / games << endl;
return 0;
}