結果
| 問題 |
No.133 カードゲーム
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-08-07 15:09:54 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 513 bytes |
| コンパイル時間 | 1,776 ms |
| コンパイル使用メモリ | 194,208 KB |
| 最終ジャッジ日時 | 2025-01-07 10:56:46 |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 19 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
int n;cin>>n;
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];
int wins=0;
int tot=0;
int p[n];
for (int i=0;i<n;i++)p[i]=i;
do {
int w=0;
for (int i=0;i<n;i++) {
if (a[p[i]] > b[i]) w++;
}
if (w > n/2) wins++;
tot++;
} while(next_permutation(p,p+n));
cout<<fixed<<(double)wins/tot<<endl;
return 0;
}