贪心地一个一个尽可能往口袋里放,容易发现和顺序无关. #include<cstdio> #include<iostream> using namespace std; typedef long long ll; int n,m,a[100100]; ll ans; int main(){ // freopen("a.in","r",stdin); scanf("%d%d",&n,&m); for(int i…
D. Fools and Foolproof Roads You must have heard all about the Foolland on your Geography lessons. Specifically, you must know that federal structure of this country has been the same for many centuries. The country consists of n cities, some pairs…