Save your cats 题意:存在n个点,有m条边( input中读入的是 边的端点,要先转化为边的长度 ),做一个最小生成树,使得要去除的边的长度总和最小; 思路:利用并查集和求最小生成树的方法,注意这里的排序要从大到小排,这样最后建树的消耗最大,反过来去除的最小; 当然题意不是这么直白,感 ...
分类:
其他好文 时间:
2018-02-14 17:06:27
阅读次数:
157
原题链接:https://vjudge.net/problem/Aizu-ALDS1_1_A 题目描述 Write a program of the Insertion Sort algorithm which sorts a sequence A in ascending order. The a ...
分类:
其他好文 时间:
2018-01-28 22:30:36
阅读次数:
210
题目链接: http://judge.u aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_4_D You are given $n$ packages of $w_i$ kg from a belt conveyor in order ($i=0,1, ...
分类:
其他好文 时间:
2017-12-13 20:08:56
阅读次数:
284
题目链接:http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0118 题意:给定一个矩阵,同类字符相连的为一个块,问总共有几个块。 输入:h,w(行和列)0 <= h <= 100,0 <= w <= 100 矩阵 输入包含多组用例,以 ...
分类:
其他好文 时间:
2017-11-09 15:04:02
阅读次数:
152
题目链接:http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=GRL_1_A Single Source Shortest Path Input An edge-weighted graph G (V, E) and the source ...
分类:
编程语言 时间:
2017-10-25 00:53:31
阅读次数:
264
题目链接: http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=GRL_1_B Single Source Shortest Path (Negative Edges) Input An edge-weighted graph G (V, ...
分类:
编程语言 时间:
2017-10-25 00:51:33
阅读次数:
328
题目链接:http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=GRL_1_C All Pairs Shortest Path Input An edge-weighted graph G (V, E). |V| is the number ...
分类:
编程语言 时间:
2017-10-25 00:38:34
阅读次数:
369
题目大意: 在一些城市中有水路和陆路连接,每一条路都有长度。但是水路必须乘船,且坐船到达某个位置后船必须留在那里,下次坐必须回到该地。现在有m城市要到达,且必须按照指定的顺序,问最小代价。 Tag: 最短路+dp 做法: 预处理出任意两点间只走水路或陆路的最小代价,然后考虑dp。 记状态dp[i][ ...
分类:
其他好文 时间:
2017-10-02 16:41:25
阅读次数:
196
Binary trees are defined recursively. A binary tree T is a structure defined on a finite set of nodes that either contains no nodes, or is composed of ...
分类:
其他好文 时间:
2017-09-16 17:21:08
阅读次数:
225
A rooted binary tree is a tree with a root node in which every node has at most two children. Your task is to write a program which reads a rooted bin ...
分类:
其他好文 时间:
2017-09-14 21:51:07
阅读次数:
243