随笔分类 -  02.搜索 - (2)DFS

摘要:今有7对数字:两个1,两个2,两个3,...两个7,把它们排成一行。要求,两个1间有1个其它数字,两个2间有2个其它数字,以此类推,两个7之间有7个其它数字。如下就是一个符合要求的排列: 17126425374635 当然,如果把它倒过来,也是符合要求的。 请你找出另一种符合要求的排列法,并且这个排 阅读全文
posted @ 2018-03-26 21:00 Dilthey 阅读(1564) 评论(0) 推荐(0)
摘要:Time limit 2000 ms Memory limit 262144 kB Source Codeforces Round #328 (Div. 2) Ari the monster is not an ordinary monster. She is the hidden identity 阅读全文
posted @ 2018-01-11 22:57 Dilthey 阅读(398) 评论(0) 推荐(0)
摘要:题目链接:http://acm.split.hdu.edu.cn/showproblem.php?pid=1045 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Problem Des 阅读全文
posted @ 2017-10-10 21:19 Dilthey 阅读(539) 评论(0) 推荐(0)
摘要:题目链接:https://hihocoder.com/problemset/problem/1334 时间限制:10000ms 单点时限:1000ms 内存限制:256MB 时间限制:10000ms 单点时限:1000ms 内存限制:256MB 描述 Given N words from the t 阅读全文
posted @ 2017-10-07 10:19 Dilthey 阅读(303) 评论(0) 推荐(0)
摘要:这道题可能有毒……总之一会儿能过一会儿不能过的,搞的我很心烦…… 依然是上次2017江苏省赛的题目,之前期末考试结束了之后有想补一下这道题,当时比较懵逼不知道怎么做……看了题解也不是很懂……就只好放弃了。 后来暑假里学了树形DP,做到了一道有关树的直径的题,把相关方面的知识点算是补了一下,不过当时没 阅读全文
posted @ 2017-08-15 01:11 Dilthey 阅读(252) 评论(0) 推荐(0)
摘要:题目链接:http://hihocoder.com/problemset/problem/1322 时间限制:10000ms 单点时限:1000ms 内存限制:256MB 时间限制:10000ms 单点时限:1000ms 内存限制:256MB 描述 给定一个包含 N 个顶点 M 条边的无向图 G , 阅读全文
posted @ 2017-08-02 00:04 Dilthey 阅读(269) 评论(0) 推荐(0)
摘要:题目链接:http://poj.org/problem?id=1321 Time Limit: 1000MS Memory Limit: 10000K Description 在一个给定形状的棋盘(形状可能是不规则的)上面摆放棋子,棋子没有区别。要求摆放时任意的两个棋子不能放在棋盘中的同一行或者同一 阅读全文
posted @ 2017-07-29 17:14 Dilthey 阅读(378) 评论(0) 推荐(0)
摘要:Time Limit: 1000MS Memory Limit: 30000K Description The city consists of intersections and streets that connect them. Heavy snow covered the city so t 阅读全文
posted @ 2017-07-24 22:16 Dilthey 阅读(352) 评论(0) 推荐(0)
摘要:题目链接:https://vjudge.net/problem/CodeForces-219D 首先,类似于网上大部分题解所说的,设某一条边正向的weight=0,反向的weight=1,因为反向意味着我们(按DFS方向)走到这条边的时候,就得把这条边翻转,就相当于记一次(w=1)。 然后同样的, 阅读全文
posted @ 2017-07-17 00:03 Dilthey 阅读(381) 评论(0) 推荐(0)
摘要:题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2196 Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Problem Descripti 阅读全文
posted @ 2017-07-15 21:50 Dilthey 阅读(523) 评论(1) 推荐(1)
摘要:题目链接:http://poj.org/problem?id=2342 Description There is going to be a party to celebrate the 80-th Anniversary of the Ural State University. The Univ 阅读全文
posted @ 2017-07-11 21:18 Dilthey 阅读(418) 评论(0) 推荐(0)
摘要:题目链接:http://acm.ecnu.edu.cn/problem/3260/ Time limit per test: 1.5 seconds Time limit all tests: 10.0 seconds Memory limit: 256 megabytes Time limit a 阅读全文
posted @ 2017-05-17 08:51 Dilthey 阅读(246) 评论(0) 推荐(0)
摘要:Time Limit: 15000/8000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Problem Description There are n Doge Planets in the Doge Space. The 阅读全文
posted @ 2017-05-06 09:51 Dilthey 阅读(204) 评论(0) 推荐(0)
摘要:依然是非常暴力的DFS,1~n这n个数字,全排列一遍,找到第一个符合的排列就是答案。 阅读全文
posted @ 2017-03-24 10:12 Dilthey 阅读(105) 评论(0) 推荐(0)
摘要:题目链接:http://poj.org/problem?id=3050 超级大水题,一次过…… 以5*5的map的某一格 ( i , j ) 为起点,dfs到deep=6,直接把得到的那个数字插入到set容器里(set容器保证每个元素不重复), 然后 i=1 to 5 { j = 1 to 5{.. 阅读全文
posted @ 2017-03-23 21:26 Dilthey 阅读(200) 评论(0) 推荐(0)
摘要:题目链接:http://poj.org/problem?id=1753 Time Limit: 1000MS Memory Limit: 65536K Description Flip game is played on a rectangular 4x4 field with two-sided 阅读全文
posted @ 2017-03-23 15:44 Dilthey 阅读(183) 评论(0) 推荐(0)
摘要:“.”能走,“#”不能走,“@”为起点,求所有能走到的地方。 BFS: DFS: 阅读全文
posted @ 2017-03-20 22:13 Dilthey 阅读(138) 评论(0) 推荐(0)