結果
| 問題 | No.133 カードゲーム | 
| コンテスト | |
| ユーザー |  makotokyoto | 
| 提出日時 | 2020-07-13 03:57:27 | 
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) | 
| 結果 | 
                                WA
                                 
                             | 
| 実行時間 | - | 
| コード長 | 517 bytes | 
| コンパイル時間 | 275 ms | 
| コンパイル使用メモリ | 12,544 KB | 
| 実行使用メモリ | 11,008 KB | 
| 最終ジャッジ日時 | 2024-11-06 18:32:14 | 
| 合計ジャッジ時間 | 1,932 ms | 
| ジャッジサーバーID (参考情報) | judge5 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | WA * 4 | 
| other | WA * 19 | 
ソースコード
from itertools import permutations
import math
N=int(input())                    #1<=N<=4
A=list(map(int,input().split()))  #1から2*Nまでのカードが存在する
B=list(map(int,input().split()))
a=permutations(A,N)
b=permutations(B,N)
n=math.factorial(N)
win=0
ans=-1
for x in a :
    for y in b :
        print(y)
        for k in range(N) : 
            if x[k]>y[k] :
                win+=1
            elif x[k]<y[k] :
                continue
        if win>(N//2) :
                ans+=1
print(ans/n)
            
            
            
        