货物收集 二分答案.复杂度\(O(n\log n)\). 货物分组 用费用提前计算的思想,考虑用一个新的箱子来装货物会发生什么. 显然费用会加上后面的所有货物的总重. \(60\)分的\(O(n^2)\)DP代码: #include<bits/stdc++.h> #define LL long long const int SIZE=100005,INF=0x3F3F3F3F; int n; LL W,A[SIZE],sum[SIZE]; LL DP[SIZE]; using std::max
作者: 负雪明烛 id: fuxuemingzhu 个人博客:http://fuxuemingzhu.cn/ 目录 题目描述 题目大意 解题方法 并查集 日期 题目地址:https://leetcode-cn.com/problems/number-of-connected-components-in-an-undirected-graph/ 题目描述 Given n nodes labeled from 0 to n - 1 and a list of undirected edges (ea