結果
問題 |
No.133 カードゲーム
|
ユーザー |
![]() |
提出日時 | 2023-10-03 20:41:40 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 43 ms / 5,000 ms |
コード長 | 836 bytes |
コンパイル時間 | 217 ms |
コンパイル使用メモリ | 82,176 KB |
実行使用メモリ | 52,480 KB |
最終ジャッジ日時 | 2024-07-26 14:10:13 |
合計ジャッジ時間 | 2,318 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 19 |
ソースコード
# N<=4なのですべての組合せを計算しても間に合うか # AだけpermutationsすればBはpermutations必要ないだろう from itertools import permutations N = int(input()) A = list(map(int, input().split())) B = list(map(int, input().split())) A_all = [] for combo in permutations(range(N), N): temp = [] for c in combo: temp.append(A[c]) A_all.append(temp) #print(A_all) win = 0 lose = 0 draw = 0 for a in A_all: win_t = 0 lose_t = 0 draw_t = 0 for i in range(N): if a[i] > B[i]: win_t += 1 elif a[i] < B[i]: lose_t += 1 elif a[i] == B[i]: draw_t += 1 if win_t > lose_t: win += 1 elif win_t < lose_t: lose += 1 elif win_t == lose_t: draw += 1 ans = win/(win+lose+draw) print(ans)