結果
問題 | 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,stringimport sysdef 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)**2cnt_game = 0for acards in a_per:for bcards in b_per:acnt = 0for acard, bcard in zip(acards, bcards):if acard>bcard:acnt+=1bcnt = n-acntif acnt>bcnt:cnt_game+=1ans = cnt_game/all_gameprint(ans)main()