結果
| 問題 |
No.133 カードゲーム
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-09-06 11:32:38 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 60 ms / 5,000 ms |
| コード長 | 801 bytes |
| コンパイル時間 | 254 ms |
| コンパイル使用メモリ | 82,164 KB |
| 実行使用メモリ | 69,824 KB |
| 最終ジャッジ日時 | 2024-11-29 06:58:16 |
| 合計ジャッジ時間 | 2,553 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 19 |
ソースコード
import bisect,collections,copy,itertools,math,string
import sys
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())
def main():
n = I()
a = LI()
b = LI()
a_per = list(itertools.permutations(a))
b_per = list(itertools.permutations(b))
all_game = math.factorial(n)**2
cnt_game = 0
for acards in a_per:
for bcards in b_per:
acnt = 0
for acard, bcard in zip(acards, bcards):
if acard>bcard:
acnt+=1
bcnt = n-acnt
if acnt>bcnt:
cnt_game+=1
ans = cnt_game/all_game
print(ans)
main()