結果
問題 | No.133 カードゲーム |
ユーザー | tomatonosuke |
提出日時 | 2019-04-11 01:21:37 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
AC
|
実行時間 | 20 ms / 5,000 ms |
コード長 | 658 bytes |
コンパイル時間 | 68 ms |
コンパイル使用メモリ | 10,924 KB |
実行使用メモリ | 8,852 KB |
最終ジャッジ日時 | 2023-09-22 21:17:45 |
合計ジャッジ時間 | 1,499 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 20 ms
8,700 KB |
testcase_01 | AC | 20 ms
8,636 KB |
testcase_02 | AC | 18 ms
8,632 KB |
testcase_03 | AC | 18 ms
8,824 KB |
testcase_04 | AC | 18 ms
8,836 KB |
testcase_05 | AC | 19 ms
8,756 KB |
testcase_06 | AC | 20 ms
8,808 KB |
testcase_07 | AC | 19 ms
8,640 KB |
testcase_08 | AC | 18 ms
8,848 KB |
testcase_09 | AC | 18 ms
8,808 KB |
testcase_10 | AC | 19 ms
8,796 KB |
testcase_11 | AC | 20 ms
8,808 KB |
testcase_12 | AC | 19 ms
8,804 KB |
testcase_13 | AC | 19 ms
8,640 KB |
testcase_14 | AC | 19 ms
8,796 KB |
testcase_15 | AC | 18 ms
8,796 KB |
testcase_16 | AC | 19 ms
8,680 KB |
testcase_17 | AC | 18 ms
8,704 KB |
testcase_18 | AC | 19 ms
8,756 KB |
testcase_19 | AC | 19 ms
8,804 KB |
testcase_20 | AC | 19 ms
8,680 KB |
testcase_21 | AC | 19 ms
8,804 KB |
testcase_22 | AC | 19 ms
8,852 KB |
ソースコード
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)