题目链接
按照每个大臣左右手上的数的乘积从小到大排序,就是最优排队方案
可以使用微扰证明,详见李煜东的算法竞赛进阶指南
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
struct node{
int a,b,c;
}q[2000];
int a1[2000],b1[2000],c1[2000];
void mul(int a1[],int x){
int j=0,i,t;
for(i=1;i<=a1[