
DFS
文章平均质量分 80
sdau_blue
念念不忘,必有回响。驰而不息,功不唐捐。
展开
-
sudoku-------九宫格
SudokuTime Limit : 4000/2000ms (Java/Other) Memory Limit : 131072/65536K (Java/Other)Total Submission(s) : 88 Accepted Submission(s) : 28Special JudgeProblem DescriptionSudoku is a very原创 2017-08-04 21:02:56 · 398 阅读 · 0 评论 -
World Cup (爆搜)
题意:就是4支队伍,两两比一场,一共6场比赛。赢了+3,输了+0,平了各加1.问给了最终得分能否推断出每一场的真实局面。这道题就是暴力枚举:1-2,1-3,1-4,2-3,2-4,3-4的所有情况。开始把f设成了全局变量。。。应该是部分变量啊啊啊啊,这个毛病老是犯代码:#include<bits/stdc++.h>using namespa...原创 2018-10-07 17:47:02 · 417 阅读 · 0 评论 -
Counting Cliques (优雅爆搜)
Sample Input34 3 21 22 33 45 9 31 31 41 52 32 42 53 43 54 56 15 41 21 31 41 51 62 32 42 52 63 43 53 64 54 65 6Sample Output3715...原创 2018-10-06 21:04:57 · 558 阅读 · 0 评论 -
What Has Dirichlet Got to Do with That?(博弈最优化问题)(记忆化搜索可做)
What Has Dirichlet Got to Do with That?time limit per test2 secondsmemory limit per test64 megabytesinputstandard inputoutputstandard outputYou all know the Dirichlet principle, the ...原创 2018-09-11 15:43:18 · 328 阅读 · 0 评论 -
BE, GE or NE(记忆化搜索(博弈类))
In a world where ordinary people cannot reach, a boy named "Koutarou" and a girl named "Sena" are playing a video game. The game system of this video game is quite unique: in the process of playing th...原创 2018-09-11 15:32:39 · 454 阅读 · 0 评论 -
Tree and Permutation(排列组合+树)好题!
Tree and Permutationhttp://acm.hdu.edu.cn/showproblem.php?pid=6446Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 1155 Accepted Submissi...原创 2018-08-27 21:42:38 · 603 阅读 · 0 评论 -
D. Recovering BST(dfs记忆化搜索)
D. Recovering BSThttp://codeforces.com/contest/1025/problem/Dtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputDima the hamster e...原创 2018-08-20 16:03:31 · 537 阅读 · 0 评论 -
Mahjong tree(构造+dfs+思维)(好题!!!)
Mahjong treeTime Limit: 6000/3000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 1927 Accepted Submission(s): 648Problem DescriptionLittle sun is an artist...原创 2018-08-06 10:36:09 · 193 阅读 · 0 评论 -
PACM TEAM(小剪枝)
链接:https://www.nowcoder.com/acm/contest/141/A来源:牛客网 Eddy was a contestant participating in ACM ICPC contests. ACM is short for Algorithm, Coding, Math. Since in the ACM contest, the most important...原创 2018-07-26 17:02:42 · 462 阅读 · 0 评论 -
同构——(思维+爆搜)
链接:https://www.nowcoder.com/acm/contest/139/D来源:牛客网 Two undirected simple graphs and where are isomorphic when there exists a bijection on V satisfying if and only if {x, y} ∈ E2.Given two g...原创 2018-07-20 19:21:19 · 2877 阅读 · 0 评论 -
Friends
首先这道题刚开始我就理解错题意了。再细读一边,they can choose to become online friends (communicating using online applications) or offline friends (mostly using face-to-face communication).由become online friends可知,说明在线和离线是...原创 2018-07-17 22:11:07 · 476 阅读 · 0 评论 -
#1322 : 树结构判定
dfs。不过这道题增加了我对树的理解,树假设有n个节点,那么边的条数一定是n-1,多一条少一条都不可以,而且通过任意一个点都能搜到其他的点(废话),所以刚开始我还在想需不需要判断环,好在题目给的数据比较友好,通过走捷径判断边的条数就好。时间限制:10000ms单点时限:1000ms内存限制:256MB描述给定一个包含 N 个顶点 M 条边的无向图 G ,判断 G 是不是一棵树。输入第一个是一个整数...原创 2018-03-18 17:40:36 · 248 阅读 · 0 评论 -
#1542 : 无根数变有根树
就是dfs啦,最近跟dfs杠上了。时间限制:10000ms单点时限:1000ms内存限制:256MB描述给定一棵包含 N 个节点的无根树,小Hi想知道如果指定其中某个节点 K 为根,那么每个节点的父节点是谁?输入第一行包含一个整数 N 和 K。1 ≤ N ≤ 1000, 1 ≤ K ≤ N。 以下N-1行每行包含两个整数 a 和 b,代表ab之间存在一条边。 1 ≤ a, b ≤ N。 输...原创 2018-03-18 17:37:17 · 226 阅读 · 0 评论 -
#1567 : 偶树的切分
这道题比较坑的地方在于要仔细读题,发现输入的节点数都是偶数,所以这样就比较好想了,只要保证子节点的个数是奇数,利用dfs即可。但是注意最后减1。因为根节点上边的边是没有的。这道题我想了很久时间限制:10000ms单点时限:1000ms内存限制:256MB描述如果一棵树节点数目是偶数,那么就称这棵树是偶树。给定一棵N个节点的偶树(编号1~N),小Hi想知道他最多可以同时切断多少条边,使得剩下的森林中...原创 2018-03-18 17:26:25 · 239 阅读 · 0 评论 -
#1694 : 删除树节点
这道题就是简单的dfs,知道根节点后依次边改子节点的父亲。时间限制:10000ms单点时限:1000ms内存限制:256MB描述给定一棵包含N个节点的有根树,编号1~N,其中第i号节点具有权值Wi。 现在小Hi要删除树中除了根以外的所有权值小于K的节点。 对于一个节点U,如果它被删除,则它的所有儿子将直接连接到U的父节点上。如果U的父节点也被删除,则连到U的父节点的父节点。以此类推。 例如对...原创 2018-03-18 17:23:13 · 261 阅读 · 0 评论 -
dfs+bfs Children of the Candy Corn
Children of the Candy Corn Time Limit : 2000/1000ms (Java/Other) Memory Limit : 131072/65536K (Java/Other)Total Submission(s) : 77 Accepted Submission(s) : 30Problem DescriptionThe cornf原创 2017-08-05 21:10:54 · 200 阅读 · 0 评论 -
分考场(dfs)
http://lx.lanqiao.cn/problem.page?gpid=T457问题描述 n个人参加某项特殊考试。 为了公平,要求任何两个认识的人不能分在同一个考场。 求是少需要分几个考场才能满足条件。输入格式 第一行,一个整数n(1<n<100),表示参加考试的人数。 第二行,一个整数m,表示接下来有m行数据 以下m行每行的格式为:两个整数a...原创 2019-03-19 20:56:15 · 491 阅读 · 0 评论