結果
| 問題 |
No.133 カードゲーム
|
| コンテスト | |
| ユーザー |
pwr_0730
|
| 提出日時 | 2018-09-01 00:08:26 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 573 bytes |
| コンパイル時間 | 1,619 ms |
| コンパイル使用メモリ | 170,088 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-09-13 22:51:02 |
| 合計ジャッジ時間 | 2,672 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 19 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int n;
int a[5], b[5];
int p, q;
double ans;
int main(){
// cin.tie(0);
// ios::sync_with_stdio(false);
cin >> n;
for(int i=0; i<n; ++i)
cin >> a[i];
for(int i=0; i<n; ++i)
cin >> b[i];
sort(a, a+n);
sort(b, b+n);
do{
do{
++q;
int tmp[3] = {};
for(int i=0; i<n; ++i){
if(a[i] > b[i]) ++tmp[0];
else if(a[i] < b[i]) ++tmp[2];
else ++tmp[1];
}
if(tmp[0] > tmp[2]) ++p;
}while(next_permutation(b, b+n));
}while(next_permutation(a, a+n));
ans = (double)p / q;
printf("%.5lf\n", ans);
}
pwr_0730