結果
| 問題 | No.133 カードゲーム |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2015-01-22 23:34:05 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 742 bytes |
| 記録 | |
| コンパイル時間 | 1,553 ms |
| コンパイル使用メモリ | 160,988 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-06-25 03:26:18 |
| 合計ジャッジ時間 | 2,027 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 19 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
#define REP(i, n) for(int(i)=0;(i)<(n);++(i))
const int MOD = int(1e9+7);
int N,M,W,H;
int res = 0;
int A[11],B[11];
int main(){
cin >> N;
REP(i,N) cin >> A[i];
REP(i,N) cin >> B[i];
int total = 0, win = 0;
sort(A,A+N);
do {
sort(B,B+N);
do {
int c = 0, d = 0;
for(int i = 0; i < N; i++){
if(A[i]>B[i]) c++; else d++;
}
if(c > d) win++;
total++;
}while(next_permutation(B,B+N));
}while(next_permutation(A,A+N));
cout << setprecision(9) << (1.*win/total) << endl;
return 0;
}