hdu 4862 Jump (费用流)
建图:新建一个temp节点,源点像temp连一条流量为k,费用为0的边,表示最多有k条路径。将原图每个点拆为两个点(i,i')表示流入该点和流出该点。temp像每个i连边,容量为1,费用为0,表示每个点都可以作为起点。为了保证每个点都被走到,每个的i向i’建边,容量为1,费用为-INF,表示费用非常非常小,它对流非常具有吸引力。每个i‘向能去的j建边,容量...
分类:
其他好文 时间:
2014-07-23 17:05:00
阅读次数:
307
Gnome TetravexTime Limit:10 Seconds Memory Limit:32768 KBHart is engaged in playing an interesting game, Gnome Tetravex, these days. In the game, at t...
分类:
其他好文 时间:
2014-07-23 16:33:01
阅读次数:
293
题目地址:HDU4862
最小费用流做的还是太少。建图想不出来。。。
直接引用官方题解的话吧。。。
最小K路径覆盖的模型,用费用流或者KM算法解决,构造二部图,X部有N*M个节点,源点向X部每个节点连一条边,流量1,费用0,Y部有N*M个节点,每个节点向汇点连一条边,流量1,费用0,如果X部的节点x可以在一步之内到达Y部的节点y,那么就连边x->y,费用为从x格子到y格子的花费能量减去得到的...
分类:
其他好文 时间:
2014-07-23 13:09:07
阅读次数:
357
题意:
n*m的格子 每个格子有个数字 你可以任选起点 每一步向下或者向右 每一步的花费是曼哈顿距离-1 如果一步的两端的格子数字一样那么你会得到这个数字的花费 问 最多选k次起点 在遍历完所有格子前提下最多剩下多少花费
思路:
题目可以表示为用最多k条路径去覆盖n*m 思路就转向了二分图
X集合表示每个点的出 Y集合表示入 如果f格子能走到g格子 那么建边...
分类:
其他好文 时间:
2014-07-23 13:07:06
阅读次数:
277
gg。。。
#include
#include
#include
#include
#include
#include
#include
#include
using namespace std;
#define ll int
#define N 220
#define M 12345
#define inf (1<<29)
//注意 点标必须是 [0 - 汇点]
//双向边,注...
分类:
其他好文 时间:
2014-07-23 00:09:19
阅读次数:
329
Problem Description
DouBiXp has a girlfriend named DouBiNan.One day they felt very boring and decided to play some games. The rule of this game is as following. There are k balls on the desk. Every...
分类:
其他好文 时间:
2014-07-23 00:05:27
阅读次数:
344
问题描述:
Given an array of non-negative integers, you are initially positioned at the first index of the array.
Each element in the array represents your maximum jump length at that position.
Determin...
分类:
其他好文 时间:
2014-07-23 00:04:37
阅读次数:
216
Problem HHelp is needed for DexterTime Limit: 3 SecondDexter is tired of Dee Dee. So he decided to keep Dee Dee busy in a game. The game he planned fo...
分类:
其他好文 时间:
2014-07-22 23:26:57
阅读次数:
301
Help Me with the Game
Time Limit: 1000MS
Memory Limit: 65536K
Total Submissions: 3344
Accepted: 2145
Description
Your task is to read a picture of a chessboard positi...
分类:
其他好文 时间:
2014-07-21 23:38:44
阅读次数:
265
点击打开链接
题意:给你一张N个节点的无向图,然后给出M条边,给出第 I 条边到第J条边的距离。然后问你是否存在子环,如果存在,则输出最成环的最短距离和
解析:构图:选定源点及汇点,然后将源点至个点流量置为1,花费置为0.然后使用最小费用流,当返回值流量和,即flow
其余和tour一样求法,处理一下某两点距离为最短距离即可。
#include
#include
#include
#...
分类:
其他好文 时间:
2014-07-21 22:28:07
阅读次数:
251