結果
問題 | No.133 カードゲーム |
ユーザー |
|
提出日時 | 2021-08-09 17:48:06 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 528 ms / 5,000 ms |
コード長 | 1,070 bytes |
コンパイル時間 | 183 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 44,496 KB |
最終ジャッジ日時 | 2024-09-21 16:47:38 |
合計ジャッジ時間 | 13,578 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 19 |
ソースコード
import sys import numpy as np #from numba import njit, b1, i1, i4, i8, f8, jitclass sys.setrecursionlimit(10**9) from itertools import permutations read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines def input(): return sys.stdin.readline().strip() #""" def from_read(dtype=np.int64): return np.fromstring(read().decode(), dtype=dtype, sep=' ') def from_readline(dtype=np.int64): return np.fromstring(readline().decode(), dtype=dtype, sep=' ') #""" #@njit("(i8,i8,i8,i8[:],i8[:],)", cache=True) def main(N, A, B): total = 1 for i in range(1, N + 1): total *= i total *= total ans = 0 for a in permutations(A, N): for b in permutations(B, N): win = 0 for aa, bb in zip(a, b): win += 1 if aa > bb else 0 ans += 1 if win > N // 2 else 0 print(ans / total) if __name__ == '__main__': N = int(input()) A = list(map(int, input().split())) B = list(map(int, input().split())) main(N, A, B)