結果

問題 No.133 カードゲーム
ユーザー 前渕竜盛
提出日時 2021-09-05 16:16:39
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 43 ms / 5,000 ms
コード長 612 bytes
コンパイル時間 358 ms
コンパイル使用メモリ 82,200 KB
実行使用メモリ 60,544 KB
最終ジャッジ日時 2024-12-21 18:09:03
合計ジャッジ時間 2,351 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 19
権限があれば一括ダウンロードができます

ソースコード

diff #

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


a_com =itertools.permutations(a, len(a))
b_com =itertools.permutations(b, len(b))

a_c =[]
b_c =[]
for i in a_com:
    a_c.append(i)
for i in b_com:
    b_c.append(i)
    

ans =0
cnt =0
for i in range(len(a_c)):
    for j in range(len(b_c)):
        cnt +=1
        apoint =0
        bpoint =0
        for s in range(n):
            if a_c[i][s] <b_c[j][s]:
                bpoint +=1
            else:
                apoint +=1
        if apoint>bpoint:
            ans +=1
print(ans/cnt)
            
    
0