結果
問題 | No.133 カードゲーム |
ユーザー |
|
提出日時 | 2017-02-23 23:16:38 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 36 ms / 5,000 ms |
コード長 | 716 bytes |
コンパイル時間 | 80 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 10,880 KB |
最終ジャッジ日時 | 2024-06-25 03:48:42 |
合計ジャッジ時間 | 1,570 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 19 |
ソースコード
import sysfrom itertools import permutationsfrom math import factorialdef solve():N = int(input())A = [int(i) for i in input().split()]B = [int(i) for i in input().split()]tot = factorial(N) ** 2win = 0for pA in permutations(A):for pB in permutations(B):cnt = 0for a, b in zip(pA, pB):if a > b:cnt += 1if cnt > N - cnt:win += 1ans = win / totprint(ans)def debug(x, table):for name, val in table.items():if x is val:print('DEBUG:{} -> {}'.format(name, val), file=sys.stderr)return Noneif __name__ == '__main__':solve()