結果

問題 No.133 カードゲーム
ユーザー ゆるくゆるく
提出日時 2015-01-22 23:49:17
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 34 ms / 5,000 ms
コード長 613 bytes
コンパイル時間 635 ms
コンパイル使用メモリ 10,976 KB
実行使用メモリ 10,396 KB
最終ジャッジ日時 2023-09-07 09:08:47
合計ジャッジ時間 2,584 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 34 ms
10,248 KB
testcase_01 AC 33 ms
10,280 KB
testcase_02 AC 33 ms
10,264 KB
testcase_03 AC 33 ms
10,312 KB
testcase_04 AC 33 ms
10,276 KB
testcase_05 AC 34 ms
10,264 KB
testcase_06 AC 33 ms
10,248 KB
testcase_07 AC 34 ms
10,344 KB
testcase_08 AC 33 ms
10,240 KB
testcase_09 AC 33 ms
10,396 KB
testcase_10 AC 33 ms
10,248 KB
testcase_11 AC 33 ms
10,272 KB
testcase_12 AC 34 ms
10,268 KB
testcase_13 AC 34 ms
10,252 KB
testcase_14 AC 33 ms
10,308 KB
testcase_15 AC 32 ms
10,244 KB
testcase_16 AC 33 ms
10,180 KB
testcase_17 AC 33 ms
10,320 KB
testcase_18 AC 33 ms
10,188 KB
testcase_19 AC 33 ms
10,312 KB
testcase_20 AC 33 ms
10,264 KB
testcase_21 AC 33 ms
10,244 KB
testcase_22 AC 33 ms
10,188 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
#sys.setrecursionlimit(n)
import heapq
import re
import bisect
import random
import math
import itertools
from collections import defaultdict, deque
from copy import deepcopy
from decimal import *

n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

aa = list(itertools.permutations(a))
bb = list(itertools.permutations(b))

win_count = 0
pt_count = 0
for ta in aa:
  for tb in bb:
    pt_count += 1
    win = 0
    for i in range(n):
      if ta[i] > tb[i]:
        win += 1
      if win > (n / 2):
        win_count += 1
        break
print(win_count / pt_count)
0