結果
| 問題 | 
                            No.133 カードゲーム
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2019-04-11 01:20:19 | 
| 言語 | Python3  (3.13.1 + numpy 2.2.1 + scipy 1.14.1)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 653 bytes | 
| コンパイル時間 | 93 ms | 
| コンパイル使用メモリ | 12,672 KB | 
| 実行使用メモリ | 10,880 KB | 
| 最終ジャッジ日時 | 2024-07-08 11:52:03 | 
| 合計ジャッジ時間 | 1,725 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge1 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 WA * 1 | 
| other | AC * 5 WA * 14 | 
ソースコード
import math
from itertools import permutations
from functools import reduce
length = int(input())
A = [int(n) for n in input().split(" ")]
B = [int(n) for n in input().split(" ")]
answer = 0
total = 0
for_win = int(math.ceil(length / 2))
for a_comb in permutations(A, length):
    for b_comb in permutations(B, length):
        temp_win = 0
        total += 1
        # print(a_comb, b_comb, for_win, total, answer)
        for i in range(length):
            if a_comb[i] > b_comb[i]:
                temp_win += 1
            if temp_win >= for_win:
                answer += 1
                break
                
            
print(answer / total)