摘要:
POJ 3041 最小点覆盖 裸匈牙利。 # include # include const int maxn = 505;
int n, k;
int c[maxn];
bool g[maxn][maxn];
bool vis[maxn];
int mark[maxn];
bool find(int u) { for (int v = 1; v <= n; ++v) if(g[u][... 阅读全文
摘要:
POJ 3630 给出n个字符串,问是否存在一个字符串是另一个的前缀。 # include # include const int maxlen = 15;
const int maxw = 10;
const int maxn = 10005 * maxw;
char str[maxlen];
int n;
int root, id;
int next[maxn][maxw];
bool ... 阅读全文
摘要:
POJ 2481 给出n个区间,第i个用\((x_i,y_i)\)表示,定义包含:i包含j等价于\(x_i\leq x_j\land y_j\leq y_i \land\lnot(x_i=x_j\land y_i=y_j)\),问对于每个区间,有多少个区间包含它。 BIT 做法:将区间排序,对所有i包含j使得i排在j前面,然后从前往后用BIT统计出所求。 需要注意的地方是两个区间相等的情况的处理... 阅读全文