import sys a = sys.stdin.readline().strip().split(' ') n,m = int(a[0]),int(a[1]) ws = sys.stdin.readline().strip().split(' ') ws = [int(i) for i in ws] ws = sorted(ws,key=lambda x:-x) ws = [abs(x) for x in ws] for i in range(m): w = int(sys.stdin.readline().strip()) for j in range(n): diff = ws[j] - w if diff in ws[j+1:]: print(str(ws[j])+' '+str(diff)) break if j == n-1:print('-1 -1') 我这个是哪里复杂了呢?超时了
点赞 2

相关推荐

2024-12-10 05:47
天津外国语大学 Java
27🐭🐭许愿offer:27确实少,沟通六百多,只约了7厂,猛猛投,还是有机会的
点赞 评论 收藏
分享
牛客网
牛客企业服务