
图论综合
图
olamins_
退役acmer
展开
-
2020牛客暑期多校训练营(第八场)A.All-Star Game (时间分治线段树)
时间限制:C/C++ 5秒,其他语言10秒空间限制:C/C++ 262144K,其他语言524288K64bit IO Format: %lld题目描述In Apollo's country, basketball is the most popular sport. There are n basketball players and m basketball fans. Bastketball players are numbered from 1 to n. Basketball fans原创 2020-12-07 22:57:51 · 311 阅读 · 0 评论 -
Manthan, Codefest 18 (rated, Div. 1 + Div. 2) E. Trips
E. Tripstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputThere arennpersons who initially don't know each other. On each morning, two of them, who were not friends before, become frie..原创 2020-11-22 12:32:54 · 293 阅读 · 0 评论 -
Codeforces Round #673 (Div. 2) F. Graph and Queries (并查集启发式合并&撤销)
F. Graph and Queriestime limit per test1.5 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given an undirected graph consisting ofnnvertices andmmedges. Initially there is a single integer writ...原创 2020-09-29 22:38:55 · 312 阅读 · 1 评论 -
Codeforces Round #228 (Div. 1) B. Fox and Minimal path (构造&最短路)
B. Fox and Minimal pathtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputFox Ciel wants to write a task for a programming contest. The task is: "You are given a simple undirected graph wi原创 2020-09-08 10:04:52 · 199 阅读 · 0 评论 -
牛客练习赛68 C-牛牛的无向图 (MST&边贡献)
时间限制:C/C++ 1秒,其他语言2秒空间限制:C/C++ 262144K,其他语言524288K64bit IO Format: %lld题目描述牛牛有一张 n 个点,m 条边的无向图,每条边有一个边权 wiw_iwi我们定义一条路径的权值是这个路径包含的边的权值的最大值。定义 d(u,v) 表示在无向图中点 u 能到达点 v 的所有路径中权值最小的路径的权值现在牛牛给你 q 次询问,每次询问给出一个 L ,询问 ∑i=1n∑j=i+1n[d(i,j)≤L]\sum_{i...原创 2020-08-28 22:00:10 · 448 阅读 · 0 评论 -
HDU6604 Blow up the city (灭绝树)
Blow up the cityTime Limit: 5000/5000 MS (Java/Others)Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 892Accepted Submission(s): 477Problem DescriptionCountry A and B are at war. Country A needs to organize transport teams ...原创 2020-07-31 21:45:33 · 238 阅读 · 0 评论 -
2020杭电多校第一场 HDU6756 Finding a MEX (分块&树状数组)
Finding a MEXTime Limit: 6000/3000 MS (Java/Others)Memory Limit: 524288/524288 K (Java/Others)Total Submission(s): 1257Accepted Submission(s): 218Problem DescriptionGiven an undirected graph G=(V,E). All vertices are numbered from 1 to N. ...原创 2020-07-22 16:40:35 · 731 阅读 · 0 评论 -
Codeforces Round #364 (Div. 2) F. Break Up(tarjan+暴力)
F. Break Uptime limit per test3 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputAgain, there are hard times in Berland! Many towns have such tensions that even civil war is possible.There arentowns in ..原创 2020-06-27 10:06:54 · 249 阅读 · 0 评论 -
Codeforces Round #649 (Div.2) D (LCA找简单环)
D. Ehab's Last Corollarytime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputGiven a connected undirected graph withnnvertices and an integerkk, you have to either:either find an indepe...原创 2020-06-14 22:43:25 · 376 阅读 · 0 评论 -
HDU5521 2015ACM/ICPC亚洲区沈阳站 Meeting (最短路&建虚拟点)
Meeting Time Limit: 12000/6000 MS (Java/Others)Memory Limit: 262144/262144 K (Java/Others) Total Submission(s): 7487Accepted Submission(s): 2264 Problem Description Bessie and her friend Elsie decide to have a meeting. However...原创 2020-06-09 09:54:52 · 269 阅读 · 0 评论 -
Codeforces Round #447 (Div. 2) E (tarjan + dp)
Ralph is going to collect mushrooms in the Mushroom Forest.There aremdirected paths connectingntrees in the Mushroom Forest. On each path grow some mushrooms. When Ralph passes a path, he collec...原创 2020-02-03 11:33:59 · 498 阅读 · 0 评论 -
Codeforces Round #600 (Div. 2) D (贪心)
D. Harmonious Graphtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou're given an undirected graph withnnnodes andmmedges. N...原创 2019-11-19 13:50:01 · 500 阅读 · 1 评论 -
#codeforces div2 597 D.Shichikuji and Power Grid (建立源点 + MST)
D. Shichikuji and Power Gridtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputShichikuji is the new resident deity of the South Bl...原创 2019-11-11 17:53:20 · 435 阅读 · 0 评论 -
#洛谷 P3119 [USACO15JAN]草鉴定Grass Cownoisseur (tarjan + spfa最长路 / 分层图最长路)
收起 题目描述In an effort to better manage the grazing patterns of his cows, Farmer John has installed one-way cow paths all over his farm. The farm consists of N fields, conveniently numbered 1..N, wit...原创 2019-09-19 10:15:10 · 421 阅读 · 3 评论 -
#HDU 6582 Path (最小割 + 最短路)
PathTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 262144/262144 K (Java/Others)Total Submission(s): 3759Accepted Submission(s): 1077Problem DescriptionYears later, Jerry fell in...原创 2019-08-25 21:53:13 · 234 阅读 · 0 评论 -
#牛客网 2018年牛客多校算法寒假训练营练习比赛(第四场)图论 + 地图搜索题解
A-石油采集题目描述随着海上运u输石油泄漏的问题,一个新的有利可图的行业正在诞生,那就是撇油行业。如今,在墨西哥湾漂浮的大量石油,吸引了许多商人的目光。这些商人们有一种特殊的飞机,可以一瓢略过整个海面20米乘10米这么大的长方形。(上下相邻或者左右相邻的格子,不能斜着来)当然,这要求一瓢撇过去的全部是油,如果一瓢里面有油有水的话,那就毫无意义了,资源完全无法利用。现在,商人想要知道,在这片...原创 2019-07-02 13:52:44 · 1257 阅读 · 0 评论 -
#HDU 1598 find the most comfortable road
题目大意 :给出一个无向图,每个权值代表速度,求出从点s到点e,速度最大时候的权值与速度最小时候的权值的最小差值;思路 : 用Kruscal从小到大依次列举每条路,如果起始点连通,计算此时的速度差值(速度递增,起点和终点即为差值最大的两点),如果无法连通,则输出-1;AC代码 :#include<iostream>#include<cstring>#inc...原创 2019-05-31 22:47:42 · 123 阅读 · 0 评论