結果
問題 | No.133 カードゲーム |
ユーザー |
![]() |
提出日時 | 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, dequefrom bisect import bisect_right, bisect_leftfrom random import randintfrom itertools import permutations# from more_itertools import distinct_permutationsfrom heapq import heappush, heappopimport sysimport mathimport copy# from sortedcontainers import SortedListsys.setrecursionlimit(100000000)n = int(input())a = list(map(int, input().split()))b = list(map(int, input().split()))ans = 0cnt2 = 0for p1 in permutations(a):for p2 in permutations(b):cnt2 += 1cnt = 0for i in range(n):if p1[i] > p2[i]:cnt += 1if cnt > (n - cnt):ans += 1ans /= cnt2print(ans)