結果
| 問題 |
No.133 カードゲーム
|
| コンテスト | |
| ユーザー |
kpinkcat
|
| 提出日時 | 2023-10-28 01:41:43 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 866 bytes |
| コンパイル時間 | 2,053 ms |
| コンパイル使用メモリ | 197,812 KB |
| 最終ジャッジ日時 | 2025-02-17 16:29:44 |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 19 |
ソースコード
#include <bits/stdc++.h>
#include<iostream>
#include<iomanip>
#include<string>
#include<algorithm>
#include<vector>
#include<set>
#include<list>
#include<queue>
#include<math.h>
#include<bitset>
using ll = long long;
using namespace std;
int main(){
int n, match = 0;
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());
sort(b.begin(), b.end());
int ans = 0;
do{
do{
match++;
int aw = 0, bw = 0;
for (int i = 0; i < n; i++){
if (a[i] > b[i]) aw++;
else bw++;
}
if (aw > bw) ans++;
}while(next_permutation(b.begin(), b.end()));
}while(next_permutation(a.begin(), a.end()));
cout << (double) ans / (double) match << endl;
}
kpinkcat