結果
| 問題 |
No.133 カードゲーム
|
| ユーザー |
tomoya
|
| 提出日時 | 2024-08-24 06:10:22 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 40 ms / 5,000 ms |
| コード長 | 703 bytes |
| コンパイル時間 | 285 ms |
| コンパイル使用メモリ | 12,672 KB |
| 実行使用メモリ | 11,392 KB |
| 最終ジャッジ日時 | 2024-08-24 06:10:25 |
| 合計ジャッジ時間 | 2,592 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 19 |
ソースコード
from collections import defaultdict, deque
from bisect import bisect_right, bisect_left
from random import randint
from itertools import permutations
# from more_itertools import distinct_permutations
from heapq import heappush, heappop
import sys
import math
import copy
# from sortedcontainers import SortedList
sys.setrecursionlimit(100000000)
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
ans = 0
cnt2 = 0
for p1 in permutations(a):
for p2 in permutations(b):
cnt2 += 1
cnt = 0
for i in range(n):
if p1[i] > p2[i]:
cnt += 1
if cnt > (n - cnt):
ans += 1
ans /= cnt2
print(ans)
tomoya