結果

問題 No.133 カードゲーム
コンテスト
ユーザー T1610
提出日時 2020-06-30 13:33:32
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 38 ms / 5,000 ms
コード長 451 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 178 ms
コンパイル使用メモリ 85,700 KB
実行使用メモリ 61,176 KB
最終ジャッジ日時 2026-04-03 15:51:27
合計ジャッジ時間 1,586 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge5_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 19
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

import itertools
n = int(input())
a = map(int, input().split(' '))
b = map(int, input().split(' '))

x = 0
y = 0

A = list(itertools.permutations(a))
B = list(itertools.permutations(b))

for a in A:
    for b in B:
        win = 0
        lose = 0
        for i in range(n):
            if a[i] > b[i]:
                win+=1
            elif a[i] < b[i]:
                lose += 1
        if win > lose:
            x += 1
        y += 1

print(x/y)
0