weight = {} value = {} tmp = {} # 存储附件 N, m = list(map(int, input().split())) # 总钱数 商品个数 for i in range(1, m+1): v, p, q = list(map(int, input().split())) # 价格 重要度 是否主件 if q == 0: value[i] = [v*p] weight[i] = [v/10] else: if q not in tmp: tmp[q] = [(...