結果
問題 |
No.133 カードゲーム
|
ユーザー |
|
提出日時 | 2021-08-09 17:39:03 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,038 bytes |
コンパイル時間 | 94 ms |
コンパイル使用メモリ | 12,416 KB |
実行使用メモリ | 44,480 KB |
最終ジャッジ日時 | 2024-09-21 16:38:51 |
合計ジャッジ時間 | 13,721 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 WA * 3 |
other | AC * 1 WA * 18 |
ソースコード
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 = from_readline() B = from_readline() main(N, A, B)