#include <bits/stdc++.h> using namespace std; #define ll long long #define out cin.tie(0)->sync_with_stdio(false) const int md = 1e9+7; int n, a[514], b[514], p[514]; bool vis[514]; int g[514][514]; //匈牙利算法,求最大匹配数 a -> b bool match(int x) { for (int i = 0; i < n; i++) { if (!vis[i] &a...