Destroying The Graph(poj 2125)】的更多相关文章

题意: 给你一张有向图,你可以选择一个点:• 摧毁其所有的入边,代价A[i].• 摧毁其所有的出边,代价B[i].• 求摧毁这张图的最小代价.• 数据范围1000 /* 很经典的一道题目(我这么弱,稍微一变形就不会了) 因为每个点涉及到出边和入边,所以可以考虑拆点,然后建图,接下来就成了一个最小点权覆盖的问题. 最小点权覆盖就是求最小割(证明可参考胡伯涛论文"最小割模型在信息学竞赛中的应用"). 接下来是输出方案,因为我们要选择的点与S或T连得边是满流的,所以可以dfs一边,只走不满流…
Destroying The Graph http://poj.org/problem?id=2125 Time Limit: 2000MS   Memory Limit: 65536K           Description Alice and Bob play the following game. First, Alice draws some directed graph with N vertices and M arcs. After that Bob tries to dest…
Charm Bracelet    POJ 3624 就是一道典型的01背包问题: #include<iostream> #include<stdio.h> #include<algorithm> #include<string.h> using namespace std; ],b[]; ]; int main() { int n,m,i,j; while(scanf("%d%d",&n,&m)!=EOF) { ;i&l…
Scout YYF I Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 5565   Accepted: 1553 Description YYF is a couragous scout. Now he is on a dangerous mission which is to penetrate into the enemy's base. After overcoming a series difficulties,…
题目链接 Problem Description As we know, Rikka is poor at math. Yuta is worrying about this situation, so he gives Rikka some math tasks to practice. There is one of them: For an undirected graph G with n nodes and m edges, we can define the distance bet…
Description P. T. Tigris is a student currently studying graph theory. One day, when he was studying hard, GS appeared around the corner shyly and came up with a problem: Given a graph with n nodes and m undirected weighted edges, every node having o…
题目链接:http://vjudge.net/contest/view.action?cid=51369#problem/A   (A - Children of the Candy Corn) http://poj.org/problem?id=2488   (A Knight's Journey) (不知道为什么,名字竟然不同哇~~~~还是poj 改名改得好) 题目意思:给出一个p * q 的棋盘,行用阿拉伯数字1,2,...,p-1, p 来表示,列从大写字母'A'开始表示.我这里为了简化…
取石子游戏 Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 37662   Accepted: 12594 Description 有两堆石子,数量任意,可以不同.游戏开始由两个人轮流取石子.游戏规定,每次有两种不同的取法,一是可以在任意的一堆中取走任意多的石子:二是可以在两堆中同时取走相同数量的石子.最后把石子全部取完者为胜者.现在给出初始的两堆石子的数目,如果轮到你先取,假设双方都采取最好的策略,问最后你是胜者还是败者…
题目:Find The Multiple 题意:求给出的数的倍数,该倍数是只由 1与 0构成的10进制数. 思路:nonzero multiple  非零倍数  啊. 英语弱到爆炸,理解不了题意..... STL 在c++过不了,  一直TLE, 最后只好看了下大神的代码. #include <iostream> #include <algorithm> #include <stdlib.h> #include <time.h> #include <c…
题目:食物链 题意:给定一些关系.判断关系的正确性,后给出的关系服从之前的关系: 思路:难点不在并查集,在于关系的判断,尤其是子节点与根节点的关系的判断: 这个关系看似没给出,但是给出子节点与父节点的关系AND父节点与根节点的关系之后,子节点与根节点的关系是可以确定的. Rank[]存的是与父节点的关系,0是同类,1是被吃,2是吃 1.若Find(x) == Find(y) ,则x y有关系,直接判断关系: 1)  d == 1, Rank[x] == Rank[y] ,  否则fake++:…