博客:http://blog.csdn.net/mypsq/article/details/39005991 #include<stdio.h> #include<string.h> #define N 30 struct node { int x,y,xx,yy; }f[N],ff[N]; int link[N],visit[N]; int main() { int n,m,i,j,k,cou,index,cnt; while(scanf("%d",&…
题目链接: 题目 A. Misha and Forest time limit per test 1 second memory limit per test 256 megabytes 问题描述 Let's define a forest as a non-directed acyclic graph (also without loops and parallel edges). One day Misha played with the forest consisting of n ver…
题目链接: https://cn.vjudge.net/problem/UVA-1572 Automatic Chemical Manufacturing is experimenting with a process called self-assembly. In this process, molecules with natural affinity for each other are mixed together in a solution and allowed to sponta…
图中的保护关系就类似于最大权闭合子图.即你想杀x,你就一定要杀掉保护x的点,那么把x向保护它的点连边.那么题目就转化成了最大权闭合子图的问题. 但是这个图有点特殊啊... 考虑有环的情况,显然这个环以及指向这个环的点都不能选. 所以还要把这个图的反图进行一遍拓扑排序,这样忽略掉了这些点了... # include <cstdio> # include <cstring> # include <cstdlib> # include <iostream> # i…