dp[i][j]:i代表前i个单位,j代表匹配的方案;
#include#include #include #include #define ll long long#define MST(vis,x) memset(vis,x,sizeof(vis))#define maxn 21#define mod 998244353using namespace std;int dp[maxn][(1<<20)+1];vector vec[22];int main(){ int n,m; while(scanf("%d%d",&n,&m)!=EOF) { for(int a=1;a<=n;a++)vec[a].clear(); for(int a=1;a<=m;a++) { int x,y; scanf("%d%d",&x,&y); vec[x].push_back(y); } dp[0][0]=1; for(int i=1;i<=n;i++)//代表前i个 { for(int j=0;j