[CF903]Party
Party
题解
看见,很容易想到状压。
令表示说有互相认识的人状态为i时,集合i中的每个人都认识集合中的其他人。
于是,转移方程式就很好想了,。
依次更新一遍就可以了。
源码
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
const int INF=0x7f7f7f7f;
const int mo=1e9+7;
typedef pair<LL,LL> pii;
int n,m,a[25],dp[(1<<22)+5],q[(1<<22)+5],f[(1<<22)+5];
void solve(int s){if(f[s])solve(f[s]);printf("%d ",q[s]);}
sig

浙公网安备 33010602011771号