結果

問題 No.133 カードゲーム
ユーザー roiti46roiti46
提出日時 2015-01-23 00:03:46
言語 Python2
(2.7.18)
結果
AC  
実行時間 11 ms / 5,000 ms
コード長 482 bytes
コンパイル時間 630 ms
コンパイル使用メモリ 6,496 KB
実行使用メモリ 6,068 KB
最終ジャッジ日時 2023-09-07 09:09:02
合計ジャッジ時間 1,865 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 9 ms
5,852 KB
testcase_01 AC 9 ms
6,028 KB
testcase_02 AC 9 ms
5,884 KB
testcase_03 AC 9 ms
5,976 KB
testcase_04 AC 10 ms
5,972 KB
testcase_05 AC 10 ms
5,976 KB
testcase_06 AC 11 ms
6,028 KB
testcase_07 AC 11 ms
5,928 KB
testcase_08 AC 8 ms
6,068 KB
testcase_09 AC 9 ms
5,924 KB
testcase_10 AC 10 ms
5,880 KB
testcase_11 AC 11 ms
5,944 KB
testcase_12 AC 10 ms
5,864 KB
testcase_13 AC 9 ms
5,888 KB
testcase_14 AC 8 ms
5,880 KB
testcase_15 AC 9 ms
5,864 KB
testcase_16 AC 10 ms
5,920 KB
testcase_17 AC 10 ms
5,976 KB
testcase_18 AC 10 ms
5,968 KB
testcase_19 AC 10 ms
5,948 KB
testcase_20 AC 11 ms
6,064 KB
testcase_21 AC 10 ms
6,028 KB
testcase_22 AC 10 ms
5,924 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def dfs(A,B,w):
    n = len(A)
    if n == 0: return 1 if w > N/2 else 0
    res = 0
    for i in range(n):
        for j in range(n):
            a = [A[k] for k in range(n) if k != i]
            b = [B[k] for k in range(n) if k != j]
            if A[i] > B[j]:
                res += dfs(a,b,w+1)
            else:
                res += dfs(a,b,w)
    return res*1.0/n/n

N = int(raw_input())
A = map(int,raw_input().split())
B = map(int,raw_input().split())

print dfs(A,B,0)
0