結果

問題 No.133 カードゲーム
ユーザー 前渕竜盛前渕竜盛
提出日時 2021-09-05 16:16:39
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 82 ms / 5,000 ms
コード長 612 bytes
コンパイル時間 294 ms
コンパイル使用メモリ 86,928 KB
実行使用メモリ 76,756 KB
最終ジャッジ日時 2023-08-23 14:14:37
合計ジャッジ時間 3,698 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
71,360 KB
testcase_01 AC 70 ms
71,540 KB
testcase_02 AC 73 ms
71,504 KB
testcase_03 AC 71 ms
71,504 KB
testcase_04 AC 72 ms
71,564 KB
testcase_05 AC 76 ms
76,580 KB
testcase_06 AC 79 ms
76,496 KB
testcase_07 AC 76 ms
76,472 KB
testcase_08 AC 71 ms
71,548 KB
testcase_09 AC 70 ms
71,520 KB
testcase_10 AC 76 ms
76,448 KB
testcase_11 AC 77 ms
76,468 KB
testcase_12 AC 78 ms
76,476 KB
testcase_13 AC 71 ms
71,560 KB
testcase_14 AC 71 ms
71,432 KB
testcase_15 AC 72 ms
71,152 KB
testcase_16 AC 82 ms
76,552 KB
testcase_17 AC 76 ms
76,268 KB
testcase_18 AC 78 ms
76,496 KB
testcase_19 AC 79 ms
76,712 KB
testcase_20 AC 77 ms
76,572 KB
testcase_21 AC 77 ms
76,756 KB
testcase_22 AC 77 ms
76,480 KB
権限があれば一括ダウンロードができます

ソースコード

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