随笔分类 -  ACM-DFS

摘要:链接:https://ac.nowcoder.com/acm/contest/272/B来源:牛客网 题目描述 给定一棵n个点的树,每个点有权值。定义表示 到 的最短路径上,所有点的点权异或和。 对于,求所有的异或和。 输入描述: 第一行一个整数n。 接下来n-1行,每行2个整数u,v,表示u,v之 阅读全文
posted @ 2018-12-01 10:24 StarHai 阅读(422) 评论(0) 推荐(0)
摘要:3109: [cqoi2013]新数独 Description Input 输入一共15行,包含一个新数独的实例。第奇数行包含左右方向的符号(<和>),第偶数行包含上下方向的符号(^和v)。 输入一共15行,包含一个新数独的实例。第奇数行包含左右方向的符号(<和>),第偶数行包含上下方向的符号(^和 阅读全文
posted @ 2018-11-09 23:46 StarHai 阅读(491) 评论(0) 推荐(0)
摘要:Given an array of integers , we say a set is a prime set of the given array, if and is prime. BaoBao has just found an array of integers in his pocket 阅读全文
posted @ 2018-10-14 20:25 StarHai 阅读(651) 评论(0) 推荐(1)
摘要:有一棵由N个结点构成的树,每一条边上都有其对应的权值。现在给定起点,求从该点出发的一条路径(至少有一条边)使得这条路径上的权值之和最大,并输出这个最大值。 Input 第一行一个正整数T,代表数据组数。每组数据第一行两个正整数n(2<=n<=10^5),s(1<=s<=n),分别表示树结点数目以及给 阅读全文
posted @ 2018-07-29 20:30 StarHai 阅读(189) 评论(0) 推荐(0)
摘要:F. Xor-Pathstime limit per test3 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputThere is a rectangul... 阅读全文
posted @ 2018-07-29 19:54 StarHai 阅读(346) 评论(0) 推荐(0)
摘要:命运石之门Time Limit: 1000 MS Memory Limit: 256 MBSubmit Status“这一切都是命运石之门的选择!“凶真博士发明了能够逆转时间的电话微波炉,也就是微型时光机。每次时光机开机时,时光机顶部的数字屏上会随机显示一个数... 阅读全文
posted @ 2018-07-29 19:53 StarHai 阅读(476) 评论(0) 推荐(0)
摘要:E. Military Problemtime limit per test3 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputIn this probl... 阅读全文
posted @ 2018-07-18 00:57 StarHai 阅读(298) 评论(0) 推荐(0)
摘要:E. Military Problem time limit per test 3 seconds memory limit per test 256 megabytes input standard input output standard output In this problem you 阅读全文
posted @ 2018-07-18 00:57 StarHai 阅读(313) 评论(0) 推荐(0)
摘要:D. Two Strings Swapstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are give... 阅读全文
posted @ 2018-07-18 00:54 StarHai 阅读(431) 评论(0) 推荐(0)
摘要:By Recognizing These Guys, We Find Social Networks Useful Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 125536/65536 K (Java/Others)Total Submi 阅读全文
posted @ 2018-07-07 22:21 StarHai 阅读(276) 评论(0) 推荐(0)
摘要:励志的猴子Time Limit: 1000 MS Memory Limit: 256 MBSubmit Status上图是2013南京亚青会吉祥物圆圆。自从它诞生以来,它就被吐槽为最丑吉祥物。即使如此,它仍然坚强的活着,并且……它还学会了人类的坐标系、画画和数... 阅读全文
posted @ 2018-07-07 15:07 StarHai 阅读(443) 评论(0) 推荐(0)
摘要:E. Reachability from the Capitaltime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard output... 阅读全文
posted @ 2018-06-28 19:16 StarHai 阅读(389) 评论(0) 推荐(0)
摘要:我们将A省简化为由N个城市组成,某些城市之间存在双向道路,而且A省的交通有一个特点就是任意两个城市之间都能通过道路相互到达,且在不重复经过城市的情况下任意两个城市之间的到达方案都是唯一的。聪明的你一定已经发现,这些城市构成了树这样一个结构。 现在百度陆续开了许许多多的... 阅读全文
posted @ 2018-03-04 23:07 StarHai 阅读(206) 评论(0) 推荐(0)
摘要:度度熊是一个喜欢计算机的孩子,在计算机的世界中,所有事物实际上都只由0和1组成。 现在给你一个n*m的图像,你需要分辨他究竟是0,还是1,或者两者均不是。 图像0的定义:存在1字符且1字符只能是由一个连通块组成,存在且仅存在一个由0字符组成的连通块完全被1所包围。 图... 阅读全文
posted @ 2018-03-04 23:00 StarHai 阅读(261) 评论(0) 推荐(0)
摘要:Given a set of sticks of various lengths, is it possible to join them end-to-end to form a square? InputThe first line of input contai... 阅读全文
posted @ 2018-01-29 20:05 StarHai 阅读(235) 评论(0) 推荐(0)