第二题 ac: N = int(input()) staff = [int(x) for x in input().split()] jobb = [int(y) for y in input().split()] M = int(input()) staff.sort() jobb.sort() count = [0 for i in range(N)] cc = 0 ii = 0 j = 0 while j < N and ii < N: if staff[ii] >= jobb[j]: cc += 1 j += 1 else: count[ii] = cc ii += 1 while ii < N: count[ii] = cc ii += 1 # print(count) mm = 0 m = 0 output = 1 while m < N: output = (count[m]-mm) * output mm +=1 m += 1 output = output % M print(output)
点赞 2

相关推荐

牛客网
牛客网在线编程
牛客网题解
牛客企业服务