結果

問題 No.133 カードゲーム
ユーザー oosakikoosakik
提出日時 2019-09-22 19:13:25
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 33 ms / 5,000 ms
コード長 871 bytes
コンパイル時間 94 ms
コンパイル使用メモリ 11,984 KB
実行使用メモリ 10,176 KB
最終ジャッジ日時 2023-10-19 07:23:18
合計ジャッジ時間 1,752 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 33 ms
10,172 KB
testcase_01 AC 30 ms
10,172 KB
testcase_02 AC 30 ms
10,172 KB
testcase_03 AC 30 ms
10,172 KB
testcase_04 AC 31 ms
10,172 KB
testcase_05 AC 31 ms
10,176 KB
testcase_06 AC 30 ms
10,176 KB
testcase_07 AC 30 ms
10,176 KB
testcase_08 AC 30 ms
10,172 KB
testcase_09 AC 30 ms
10,172 KB
testcase_10 AC 30 ms
10,176 KB
testcase_11 AC 30 ms
10,176 KB
testcase_12 AC 31 ms
10,176 KB
testcase_13 AC 30 ms
10,172 KB
testcase_14 AC 30 ms
10,172 KB
testcase_15 AC 30 ms
10,172 KB
testcase_16 AC 31 ms
10,176 KB
testcase_17 AC 31 ms
10,176 KB
testcase_18 AC 30 ms
10,176 KB
testcase_19 AC 30 ms
10,176 KB
testcase_20 AC 29 ms
10,176 KB
testcase_21 AC 30 ms
10,176 KB
testcase_22 AC 30 ms
10,176 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def run():
  N = int(input())
  A_list = list(map(int, input().split()))
  B_list = list(map(int, input().split()))
  array_A_list = array(A_list, N)
  array_B_list = array(B_list, N)
  #print(array_A_list)
  num_win = 0
  total = 0
  for a_list in array_A_list:
    for b_list in array_B_list:
      sub_total = 0
      total += 1
      #print(a_list, b_list)
      for a, b in zip(a_list, b_list):
        if a > b: sub_total += 1
      if sub_total > N//2:
        num_win += 1
  print(num_win/total)
  #print(num_win, total)

def add(pre_list, n_list):
  new_list = []
  for pre in pre_list:
    for n in n_list:
      if (n in pre) == False:
        new_list.append(pre+[n])
  return new_list

def array(n_list, N):
  res_list = [[n] for n in n_list]
  for n in range(N-1):
    res_list = add(res_list, n_list)
  return res_list
  
if __name__ == '__main__':
  run()
0