結果

問題 No.133 カードゲーム
ユーザー neko_the_shadowneko_the_shadow
提出日時 2017-01-21 20:38:26
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 33 ms / 5,000 ms
コード長 608 bytes
コンパイル時間 88 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 10,752 KB
最終ジャッジ日時 2024-06-25 03:45:29
合計ジャッジ時間 1,591 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 19
権限があれば一括ダウンロードができます

ソースコード

diff #

import itertools

if __name__ == '__main__':
    n = int(input())
    a = list(map(int, input().split()))
    b = list(map(int, input().split()))

    numer = denom = 0
    for a_cards, b_cards in itertools.product(itertools.permutations(a), itertools.permutations(b)):
        a_win = b_win = draw = 0
        for i in range(n):
            a_card, b_card = a_cards[i], b_cards[i]
            if a_card >  b_card: a_win += 1
            if a_card == b_card: draw += 1
            if a_card <  b_card: b_win += 1
        
        if a_win > b_win: numer += 1
        denom += 1
    
    print(numer / denom)
0