http://poj.org/problem?id=1789 Truck History Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 32474 Accepted: 12626 Description Advanced Cargo Movement, Ltd. uses trucks of different types. Some trucks are used for vegetable delivery, o…
题目连接:http://poj.org/problem?id=1789 Description Advanced Cargo Movement, Ltd. uses trucks of different types. Some trucks are used for vegetable delivery, other for furniture, or for bricks. The company has its own code describing each type of a truc…
poj:1258 Agri-Net Time Limit: 1000 MS Memory Limit: 10000 KB 64-bit integer IO format: %I64d , %I64u Java class name: Main [Submit] [Status] [Discuss] Description Farmer John has been elected mayor of his town! One of his campaign promises was to bri…
Truck History Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 18981 Accepted: 7321 Description Advanced Cargo Movement, Ltd. uses trucks of different types. Some trucks are used for vegetable delivery, other for furniture, or for brick…
Truck History Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 20768 Accepted: 8045 Description Advanced Cargo Movement, Ltd. uses trucks of different types. Some trucks are used for vegetable delivery, other for furniture, or for brick…
网址:https://vjudge.net/contest/66965#overview 第一题: poj1251 裸最小生成树 #include<iostream> #include<algorithm> #include<cstring> using namespace std; const int maxn=100500; struct node { int x; int y; int w; }a[maxn]; int n,k; char s,v; int cnt…
以此图为例: package com.datastruct; import java.util.Scanner; public class TestKruskal { private static class Edge{ public Edge(int begin,int end,int weight){ this.begin = begin; this.end = end; this.weight = weight; } int begin; int end; int weight; publ…
poj 1251 Jungle Roads (最小生成树) Link: http://poj.org/problem?id=1251 Jungle Roads Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 23507 Accepted: 11012 Description The Head Elder of the tropical island of Lagrishan has a problem. A b…
对于一个给定的连通的无向图 G = (V, E),希望找到一个无回路的子集 T,T 是 E 的子集,它连接了所有的顶点,且其权值之和为最小. 因为 T 无回路且连接所有的顶点,所以它必然是一棵树,称为生成树(Spanning Tree),因为它生成了图 G.显然,由于树 T 连接了所有的顶点,所以树 T 有 V - 1 条边.一张图 G 可以有很多棵生成树,而把确定权值最小的树 T 的问题称为最小生成树问题(Minimum Spanning Tree).术语 "最小生成树" 实际上是…
最近在复习数据结构,所以想起了之前做的一个最小生成树算法.用Kruskal算法实现的,结合堆排序可以复习回顾数据结构.现在写出来与大家分享. 最小生成树算法思想:书上说的是在一给定的无向图G = (V, E) 中,(u, v) 代表连接顶点 u 与顶点 v 的边(即),而 w(u, v) 代表此边的权重,若存在 T 为 E 的子集(即)且为无循环图,使得的 w(T) 最小,则此 T 为 G 的最小生成树.说白了其实就是在含有 n 个顶点的连通网中选择 n-1 条边,构成一棵极小连通子图,并使该连…
Qin Shi Huang's National Road System Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 6137 Accepted Submission(s): 2143 Problem Description During the Warring States Period of ancient China(47…
//归并排序递归方法实现 #include <iostream> #include <cstdio> using namespace std; #define maxn 1000005 int a[maxn], temp[maxn]; long long ans; void MergeSort(int a[], int l, int mid, int r) { ; int i = l, n = mid, j = mid, m = r; while ( i<n &&am…
The Unique MST Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 28207 Accepted: 10073 Description Given a connected undirected graph, tell if its minimum spanning tree is unique. Definition 1 (Spanning Tree): Consider a connected, undir…
Arctic Network Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 17758 Accepted: 5646 Description The Department of National Defence (DND) wishes to connect several northern outposts by a wireless network. Two different communication tec…