样例如图,加上各个集合的和就好了,然后每次集合都是剔除最小值得到新集合的
#include<stdio.h>
#include<string.h>
#include<queue>
#include<algorithm>
using namespace std;
#define rep(a, b) for(int i = (a); i <= (b); i++)
#define rev(a, b, i) for(int i = (a); i >= (b); i--)
#define FOR(a, b, i) for(int i = (a); i < (b); i++)
typedef long long LL;
int n;
int a;
struct cmp1{
bool operator ()(int &a,int &b){
return a>b;//最小值优先......
阅读全文