結果
| 問題 | No.133 カードゲーム | 
| コンテスト | |
| ユーザー |  Okuda_desu | 
| 提出日時 | 2018-04-22 00:21:53 | 
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 2 ms / 5,000 ms | 
| コード長 | 474 bytes | 
| コンパイル時間 | 1,697 ms | 
| コンパイル使用メモリ | 169,776 KB | 
| 実行使用メモリ | 5,376 KB | 
| 最終ジャッジ日時 | 2024-06-27 05:31:29 | 
| 合計ジャッジ時間 | 2,315 ms | 
| ジャッジサーバーID (参考情報) | judge1 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 4 | 
| other | AC * 19 | 
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main() {
	int N;
	int A[4],B[4];
	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);
	int p = 0;
	int n = 0;
	do {
		do {
			p++;
			int m = 0;
			for (int i = 0; i < N; i++) {
				if (A[i] > B[i]) m++;
			}
			if (m > N - m) n++;
		} while (next_permutation(B, B + N));
	} while (next_permutation(A, A + N));
	cout << (double) n / p << endl;
}
            
            
            
        