結果
| 問題 | No.133 カードゲーム | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2025-10-08 11:17:38 | 
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 58 ms / 5,000 ms | 
| コード長 | 388 bytes | 
| コンパイル時間 | 249 ms | 
| コンパイル使用メモリ | 12,288 KB | 
| 実行使用メモリ | 10,240 KB | 
| 最終ジャッジ日時 | 2025-10-08 11:17:43 | 
| 合計ジャッジ時間 | 2,498 ms | 
| ジャッジサーバーID (参考情報) | judge4 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 4 | 
| other | AC * 19 | 
ソースコード
import itertools
N=int(input())
A=list(map(int, input().split()))
B=list(map(int, input().split()))
count=0
total=0
for a_perm in itertools.permutations(A):
    for b_perm in itertools.permutations(B):
        a_win=0
        for i in range(N):
            if a_perm[i] > b_perm[i]:
                a_win+=1
        if a_win>N/2:
            count+=1
        total+=1
print(count/total)
            
            
            
        