結果
問題 | No.133 カードゲーム |
ユーザー |
|
提出日時 | 2019-04-11 01:21:37 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 31 ms / 5,000 ms |
コード長 | 658 bytes |
コンパイル時間 | 161 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 11,008 KB |
最終ジャッジ日時 | 2024-07-08 11:52:40 |
合計ジャッジ時間 | 1,799 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 19 |
ソースコード
import math from itertools import permutations from functools import reduce length = int(input()) A = [int(n) for n in input().split(" ")] B = [int(n) for n in input().split(" ")] answer = 0 total = 0 for_win = int(math.floor(length / 2)) + 1 for a_comb in permutations(A, length): for b_comb in permutations(B, length): temp_win = 0 total += 1 # print(a_comb, b_comb, for_win, total, answer) for i in range(length): if a_comb[i] > b_comb[i]: temp_win += 1 if temp_win >= for_win: answer += 1 break print(answer / total)