随笔分类 - 图论
摘要:题意:给你一个n边n点的无向连通图,两个操作,操作一改变某个边的权值,操作二查询某两个点之间的路径长度。 题解:随便删掉环上一条边搞一棵树出来,因为两点间距离是两点各自到根的距离之和减去2*lca两点到根的距离。 所以修改操作就变为维护点到根这条链上的权值,差分一下 采用树状数组维护。 查询的时候就
阅读全文
摘要:F. Simple Cycles Edges time limit per test 2 seconds time limit per test memory limit per test 256 megabytes memory limit per test input standard inpu
阅读全文
摘要:D. Almost Acyclic Graph time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output D. Almost Acyclic
阅读全文
摘要:众所周知,蒜蒜是一名热爱工作的好员工,他觉得时间就是金钱,做事情总是争分夺秒。 这天晚上,蒜蒜一个人去吃晚饭。不巧的是,吃完饭以后就开始下雨了,蒜蒜并没有带雨伞出来。但是蒜蒜热爱工作,工作使他快乐,他要尽快赶回去写代码。 蒜蒜的公司在中关村,中关村这边地形复杂,有很多天桥、地下通道和马路交错在一起。
阅读全文
摘要:题意:给你M,N,K,代表你有M点法力值,N个物品,K个制造方式 接下来N行,如果以1开头则代表既能卖又能合成,0代表只能卖。 然后K行,每行第一个数是要合成的东西,第二个数代表有几对,每对第一个数是那种物品,第二个是需要几个。 注意不能直接合成的可以通过制造方式来合成。然后问你花费完所有的法力制造
阅读全文
摘要:题意:给你点和边,让你找最小环的权值,其权值是所有边权的和,没环输出-1。 解法:枚举每一条边,找到其端点,做最短路。、
阅读全文
摘要:有向图的图联通是指基图联通,也就是把有向图的边改成无向图然后看是否连通。判断联通可用dfs或者并查集。 题意就是给你n个由小写字母构成的字符串,问你能不能将这n个字符串连接起来,B能接在A后面的条件是A的最后一个字母==B的第一个字母。 然后就是将26个小写字母看成顶点集,对于一个字符串,其首字母向
阅读全文
摘要:Muddy Fields Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 10961 Accepted: 4071 Description Rain has pummeled the cows' field, a rectangu
阅读全文
摘要:Treasure Exploration Time Limit: 6000MS Memory Limit: 65536K Total Submissions: 8909 Accepted: 3644 Description Have you ever read any book about trea
阅读全文
摘要:King's Quest Time Limit: 15000MS Memory Limit: 65536K Total Submissions: 9460 Accepted: 3497 Case Time Limit: 2000MS Description Once upon a time ther
阅读全文
摘要:Sorting Slides Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 4777 Accepted: 1867 Description Professor Clumsey is going to give an import
阅读全文
摘要:In this problem, we will define a graph called star graph, and the question is to find the minimum distance between two given nodes in the star graph.
阅读全文
摘要:Destroying The Graph Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 8503 Accepted: 2753 Special Judge Description Alice and Bob play the f
阅读全文
摘要:Paratroopers Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 8837 Accepted: 2663 Description It is year 2500 A.D. and there is a terrible w
阅读全文
摘要:Firing Time Limit: 5000MS Memory Limit: 131072K Total Submissions: 10905 Accepted: 3291 Description You’ve finally got mad at “the world’s most stupid
阅读全文
摘要:The Maximum Number of Strong Kings Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 2302 Accepted: 1056 Description A tournament can be repr
阅读全文
摘要:Unique AttackTime Limit: 5 Seconds Memory Limit: 32768 KB N supercomputers in the United States of Antarctica are connected into a network. A network
阅读全文
摘要:Dual Core CPU Time Limit: 15000MS Memory Limit: 131072K Total Submissions: 25099 Accepted: 10866 Case Time Limit: 5000MS Description As more and more
阅读全文
摘要:Steady Cow Assignment Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 6914 Accepted: 2387 Description Farmer John's N (1 <= N <= 1000) cows
阅读全文

浙公网安备 33010602011771号