結果
| 問題 | No.133 カードゲーム | 
| コンテスト | |
| ユーザー |  ldsyb | 
| 提出日時 | 2016-08-01 18:00:43 | 
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 2 ms / 5,000 ms | 
| コード長 | 432 bytes | 
| コンパイル時間 | 593 ms | 
| コンパイル使用メモリ | 67,712 KB | 
| 実行使用メモリ | 5,376 KB | 
| 最終ジャッジ日時 | 2024-06-25 03:43:52 | 
| 合計ジャッジ時間 | 1,287 ms | 
| ジャッジサーバーID (参考情報) | judge2 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 4 | 
| other | AC * 19 | 
ソースコード
#include <iostream>
#include <algorithm>
using namespace std;
int main(){
	int all = 0,win = 0,n;
	cin >> n;
	int a[n],b[n],numa[n];
	for(int i = 0;i < n;i++){
		cin >> a[i];
		numa[i] = i;
	}
	for(int i = 0;i < n;i++) cin >> b[i];
	do{
		int count = 0;
		for(int i = 0;i < n;i++) count += (a[numa[i]] > b[i] ? 1 : -1);
		if(count > 0) win++;
		all++;
	}while(next_permutation(numa,numa + n));
	cout << double(win) / all << endl;
}
            
            
            
        