結果
| 問題 | No.133 カードゲーム |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-09-06 11:32:38 |
| 言語 | PyPy3 (7.3.23 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 46 ms / 5,000 ms |
| + 890µs | |
| コード長 | 801 bytes |
| 記録 | |
| コンパイル時間 | 66 ms |
| コンパイル使用メモリ | 81,360 KB |
| 実行使用メモリ | 72,924 KB |
| 最終ジャッジ日時 | 2026-10-01 21:25:32 |
| 合計ジャッジ時間 | 3,620 ms |
|
ジャッジサーバーID (参考情報) |
judge4_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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()