随笔分类 - 图的全家桶/ 最短路/Tarjan强连通/MST/拓扑
摘要:HDU-6252 - Subway Chasing(差分约束/不等式组) 题目链接: HDU - 6252 题面: 题意: 雷格西桑和路易桑是好朋友,在同一家公司工作。他们总是一起乘地铁去上班。他们的路线上有N个地铁站,编号从1到N。1站是他们的家,N站是公司。 有一天,雷格西桑起床晚了。当他来到车
阅读全文
摘要:2019 ICPC Asia Yinchuan Regional-H. Delivery Route(dijkstra+拓扑排序) 题面: 题意: 给定一个含有n 个点,x个双向边,y个单向边的图,其中双向边的权值一定为正整数,单向边的权值
阅读全文
摘要:[Codeforces Round #677 (Div. 3)] G. Reducing Delivery Cost (dijkstra,枚举) 题面: 题意: 给定一个含有n个点m个边的图,和k个点对,让你选择一个边将其权值变为0,使其$
阅读全文
摘要:Instability [HDU - 5917 ](Ramsey定理) 题面: Long long ago, there was a prosperous kingdom which consisted of n cities and every two cites were connected b
阅读全文
摘要:[AtCoder Beginner Contest 175]-F - Making Palindrome(回文串+dijkstra) 题面: 题意: 给定n 个字符串,每一个字符串使用一次的成本是Ci,每一个字符串可以使用多次,现在问你去选择一些字符串将其按照一定的顺序排列
阅读全文
摘要:HDU-6858 Discovery of Cycles (LCT,双指针,ST表) Problem Description In response to the 8202 Olympics, Quber City, which was the host of the competition, is
阅读全文
摘要:[Codeforces Round #656 (Div. 3)] (E. Directing Edges)拓扑排序 思路: 首先考虑给定的有向边构成的图就存在环的话,输出NO。 其他情况则一定可以有合法的方案,输出YES,然后先拿给定的那些有向边进行拓扑排序,设idi为节点$\mathit i
阅读全文
摘要:最短路 2 [HDU - 6714 ](dijkstra算法) 题目链接:https://vjudge.net/problem/HDU-6714 思路: 仔细分析可以得知: w[i][j]为i−>j的最短路径中不包含端点的最大编号节点(如果有多个最短路径,选择最大编号节点较小的那个。) 那么
阅读全文
摘要:[AtCoder Beginner Contest 164] E Two Currencies (分层最短路) Problem Statement There are NN cities numbered 11 to NN, connected by MM railroads. You are no
阅读全文
摘要:牛客算法周周练3 C 小雨坐地铁(分层最短路) 链接:https://ac.nowcoder.com/acm/contest/5338/C 来源:牛客网 思路: dp[i][j] 表示到第i个节点时在第j个地铁上的最小花费。 然后dijkstra算法跑
阅读全文
摘要:[Codeforces Round 636 (Div. 3)] E. Weights Distributing (BFS+最短路+贪心) E. Weights Distributing time limit per test 2 seconds memory limit per test 256 m
阅读全文
摘要:HDU 6187 Destroy Walls (思维,最大生成树) Destroy Walls \ Time Limit: 8000/4000 MS (Java/Others) Memory Limit: 132768/132768 K (Java/Others) Total Submission(
阅读全文
摘要:牛客练习赛50 D tokitsukaze and Event 链接:https://ac.nowcoder.com/acm/contest/1080/D来源:牛客网 时间限制:C/C++ 1秒,其他语言2秒 空间限制:C/C++ 524288K,其他语言1048576K 64bit IO Form
阅读全文
摘要:ACM ICPC 2018 徐州赛区网络预赛 J. Maze Designer J. Maze Designer After the long vacation, the maze designer master has to do his job. A tour company gives him
阅读全文
摘要:"292D Connected Components" D. Connected Components time limit per test 2 seconds memory limit per test 256 megabytes input standard input output stan
阅读全文
摘要:Make It Connected "CodeForces 1095F " You are given an undirected graph consisting of nn vertices. A number is written on each vertex; the number on v
阅读全文
摘要:Almost Acyclic Graph "CodeForces 915D " time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Y
阅读全文
摘要:P3119 [USACO15JAN]草鉴定Grass Cownoisseur 题目描述 In an effort to better manage the grazing patterns of his cows, Farmer John has installed one way cow path
阅读全文
摘要:Connected Components? "CodeForces 920E " You are given an undirected graph consisting of n vertices and edges. Instead of giving you the edges that ex
阅读全文
摘要:P3469 [POI2008]BLO Blockade https://www.luogu.org/problem/P3469 题目描述 There are exactly n n towns in Byteotia. Some towns are connected by bidirectiona
阅读全文