阿里笔试0804 跪求!求问各位大佬 这为啥是0ac
第一题做到这里0ac 心态崩了 怎么也该有个10%吧 二分没有心情写了 孩子没了
n, m = map(int, input().split())
person = list(map(int, input().split()))
house = []
for i in range(m):
house.append(list(map(int, input().split())))
person = sorted(person,reverse = True)
house = sorted(house, key = lambda x:x[0], reverse = True)
ans = []
visited = []
for i in range(n):
conf = float('-inf')
idx = -1
for j in range(m):
if person[i]>=house[j][1] and house[j][0]>=conf and j not in visited:
conf = house[j][0]
idx = j
break
if idx!=-1:
visited.append(idx)
ans.append(conf)
if ans == []:
print(0)
else:
print(sum(ans))
#笔试题目##阿里巴巴#
