結果
問題 | No.133 カードゲーム |
ユーザー |
![]() |
提出日時 | 2020-04-03 01:46:59 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 33 ms / 5,000 ms |
コード長 | 999 bytes |
コンパイル時間 | 80 ms |
コンパイル使用メモリ | 12,416 KB |
実行使用メモリ | 10,880 KB |
最終ジャッジ日時 | 2024-06-28 16:30:00 |
合計ジャッジ時間 | 1,650 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 19 |
ソースコード
# import sys# readline = sys.stdin.buffer.readlinefrom collections import dequefrom copy import copy,deepcopyfrom itertools import permutations,combinationsdef myinput():return map(int,input().split())def mycol(data,col):return [ row[col] for row in data ]n = int(input())a = list(myinput())b = list(myinput())pa = list(permutations(a))pb = list(permutations(b))# print(pa)# print(pb)count_win_a = 0count_win_b = 0count_match = 0for pattern_a in pa:for pattern_b in pb:count_match += 1count_a = 0count_b = 0for i in range(n):card_a = pattern_a[i]card_b = pattern_b[i]if card_a > card_b:count_a += 1else:count_b += 1if count_a > count_b:count_win_a += 1elif count_a==count_b:passelse:count_win_b += 1# print(count_win_a,count_match)ans = count_win_a/count_matchprint(ans)