結果
| 問題 |
No.133 カードゲーム
|
| コンテスト | |
| ユーザー |
T_shinobu
|
| 提出日時 | 2019-08-15 03:58:42 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 31 ms / 5,000 ms |
| コード長 | 1,013 bytes |
| コンパイル時間 | 187 ms |
| コンパイル使用メモリ | 12,672 KB |
| 実行使用メモリ | 10,752 KB |
| 最終ジャッジ日時 | 2024-09-19 14:47:29 |
| 合計ジャッジ時間 | 1,680 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 19 |
ソースコード
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
seen = [0 for i in range(2*n)]
p = []
num = []
win_count = 0
match_count = 0
def dfs(x):
global win_count
global match_count
if sum(seen) == 2*n:
count = 0
for i in range(n):
if a[p[i]] > b[p[i+n]-n]:
count += 1
if count / n > 0.50:
win_count += 1
match_count += 1
return
for i in range(2*n):
length = len(p)
if length < n and i < n:
if seen[i] == 0:
seen[i] = 1
p.append(i)
dfs(i)
seen[i] = 0
p.pop()
if length >= n and i >= n:
if seen[i] == 0:
seen[i] = 1
p.append(i)
dfs(i)
seen[i] = 0
p.pop()
for i in range(n):
seen[i] = 1
p.append(i)
dfs(i)
seen[i] = 0
p.pop()
print(win_count / match_count)
T_shinobu