简述: 用dfn作为时间戳,对图进行dfs并对路径上的点入栈,求出每个点可以访问到的最早的时间戳,此时栈中从这个点开始的点便为一个强连通分量。 模板: 1 void tarjan(int x,int lay,int &sccnum) { 2 low[x]=lay; 3 dfn[x]=lay; 4 v ...
分类:
编程语言 时间:
2019-09-10 23:50:51
阅读次数:
105
https://www.luogu.org/problem/P2947 题目描述 Farmer John's N (1 <= N <= 100,000) cows, conveniently numbered 1..N, are once again standing in a row. Cow i ...
分类:
其他好文 时间:
2019-09-10 01:07:10
阅读次数:
101
Linux的桌面虚拟化技术KVM(一)——新建KVM虚拟机 Linux的桌面虚拟化技术KVM(二)——远程桌面管理 Linux的桌面虚拟化技术KVM(三)——KVM虚拟机克隆和快照 (1).常用镜像格式对比 目前常用虚拟机镜像格式:raw、cow、qcow、qcow2、vmdk。 1)raw raw ...
分类:
系统相关 时间:
2019-09-09 13:06:56
阅读次数:
127
One cow from each of N farms (1 ≤ N ≤ 1000) conveniently numbered 1..N is going to attend the big cow party to be held at farm #X (1 ≤ X ≤ N). A total ...
分类:
其他好文 时间:
2019-09-06 20:07:15
阅读次数:
81
题:https://www.luogu.org/problem/P3115 题意:给出起点A,终点B,N条路线,下面没俩行一个路线,第一行是俩个数,第一个为这条路线的花费,第二个为这条路线经过的点数n,第二行即为n个整数表示这条路径; 分析:1、题目有说如果要跳转航线就要花费被跳往航线的的费用,所以 ...
分类:
其他好文 时间:
2019-09-05 01:05:06
阅读次数:
88
链接:https://vjudge.net/problem/POJ-3278 Farmer John has been informed of the location of a fugitive cow and wants to catch her immediately. He starts a ...
分类:
其他好文 时间:
2019-09-01 01:49:14
阅读次数:
140
原题 题目链接 题目分析 明显的01背包,但还是由细节需要处理,设置dp[i][j]=前i头牛中选的TF为j时最大的TS值,由于TF可能为负数因此要加一个基数使其在大于等于零,dp初始化为-1,dp[0][0]=0.更新的时候dp[i][j]=max(dp[i-1][j-f[i]]+s[i],dp[ ...
分类:
其他好文 时间:
2019-08-26 22:56:59
阅读次数:
88
"Silver Cow Party" 给出一个n个点m条边的有向图,$w[i][j]$为i到j的边权,给出一个点X,询问从每个点出发到达X再回到起点的路径长度和最大值,$n\leq 1000,m\leq 100000$。 解 显然为单源最短路径的题目,考虑点为起点终点的取反,建反边,工具是bfs(边 ...
分类:
其他好文 时间:
2019-08-25 17:55:18
阅读次数:
79
Problem Description N (1 ≤ N ≤ 100) cows, conveniently numbered 1..N, are participating in a programming contest. As we all know, some cows code bette ...
分类:
其他好文 时间:
2019-08-24 22:57:58
阅读次数:
80