这是题目--->
http://usaco.org/index.php?page=viewproblem2&cpid=1085#
a1=int(input())
a=list(input().split(' '))
b=input().split(' ')
res=[str(i-i) for i in range(a1)]
book=[str('false') for i in range(a1)]
n=len(a)
d=0
def dfs(step):
global d?%ra=link
if step==n:
#---
c=0
for j2 in range(a1):
if res[j2]<=b[j2]:
c+=1
else:
break
if c==a1:
d+=1
#---
else:
for i in range(n):
if (book[i]=='false') and a[i]<=b[step]:
res[step]=a[i]
book[i]='true'
dfs(step+1)
book[i]='false'
dfs(0)
print(d)
6~12的递归时间过长
我用了深度优先遍历来搜索
还加了一些限制条件
可是还是太长了