結果
問題 | No.133 カードゲーム |
ユーザー | kamojiro24e |
提出日時 | 2018-08-05 02:49:54 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 568 bytes |
コンパイル時間 | 271 ms |
コンパイル使用メモリ | 11,900 KB |
実行使用メモリ | 10,196 KB |
最終ジャッジ日時 | 2023-10-19 22:00:13 |
合計ジャッジ時間 | 1,981 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 29 ms
10,188 KB |
testcase_01 | AC | 29 ms
10,188 KB |
testcase_02 | AC | 29 ms
10,188 KB |
testcase_03 | AC | 29 ms
10,188 KB |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | AC | 29 ms
10,188 KB |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | AC | 30 ms
10,188 KB |
testcase_18 | WA | - |
testcase_19 | WA | - |
testcase_20 | WA | - |
testcase_21 | WA | - |
testcase_22 | WA | - |
ソースコード
from itertools import permutations N = int(input()) A = list(map(int, input().split())) B = list(map(int, input().split())) def factorial(n): if n == 0: return 1 else: return n*factorial(n-1) Awin = 0 for a in permutations(range(N),N): for b in permutations(range(N),N): akachi = 0 bkachi = 0 for i in range(N): if A[a[i]] > B[b[i]]: akachi += 1 elif A[a[i]] < B[b[i]]: bkachi += 1 if akachi > bkachi: Awin += 1 print(Awin/(factorial(N)*2))