ZOJ 3631 Watashi's BG DFS】的更多相关文章

J - Watashi's BG Time Limit:3000MS     Memory Limit:65536KB     64bit IO Format:%lld & %llu Submit Status Practice ZOJ 3631 Appoint description:   Description Watashi is the couch of ZJU-ICPC Team and he is very kind hearted. In ZJU-ICPC summer train…
Watashi's BG Time Limit: 3 Seconds      Memory Limit: 65536 KB Watashi is the couch of ZJU-ICPC Team and he is very kind hearted. In ZJU-ICPC summer training camp, students are divided into several groups and each day one of the groups will design so…
题目链接: 题目 Escape Time II Time Limit: 20 Sec Memory Limit: 256 MB 问题描述 There is a fire in LTR ' s home again. The fire can destroy all the things in t seconds, so LTR has to escape in t seconds. But there are some jewels in LTR ' s rooms, LTR love jewe…
ZOJ - 4124Median 题目大意:有n个元素,给出m对a>b的关系,问哪个元素可能是第(n+1)/2个元素,可能的元素位置相应输出1,反之输出0 省赛都过去两周了,现在才补这题,这题感觉不难,可能那时脑子混了,题意也没理解清楚.根据题目很容易看出,这跟拓扑排序有关,不过拓扑排序的作用在于判断给出的关系是否矛盾,在找判断可能是第(n+1)/2个元素还主要是思维. 哪个元素可能是中间的(n+1)/2个元素呢,就是那些明确在它前面的元素(比它大的)的数目和在它后面的元素(比它小的)的数目都不…
嗯... 题目链接:https://zoj.pintia.cn/problem-sets/91827364500/problems/91827364501 这道题是想出来则是一道很简单的dfs: 将一个4*4的地图给每一个点排序,如下图: 0  1  2  3 4  5  6  7 8  9  10  11 12 13 14 15 设一个点为第k个点,那么它的坐标为(k/n,k%n),根据这个进行dfs,当k == n * n是退出dfs.如果k < n *n,就继续dfs,判断是否能放下,即要…
http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=4834 从点1出发,假设现在在i,点数为sta,则下一步的点数必然不能是sta的因数,所以不会形成环,只需从1直接走,走到n即可. 但是如果这样的话时空复杂度就都是nk,明显不满足题意,而这个时候我们可以想到,每个状态都必然是k的约数,(点数不是k的约数的节点不在路上,可以无视),而约数的个数也就k^0.5个,可以直接用map映射,这样时空复杂度都是n*k^0.5,可以解出答案…
题目链接 题意 : 将n*n个正方形进行排列,需要判断相邻的正方形的相邻三角形上边的数字是不是都相等. 思路 : 只知道是个深搜,一开始不知道怎么搜,后来看了题解才明白,就是说不是自己去搜,而是将给定的正方形按照要求一个个往上摆,如果摆不下去了肯定是没有结果的.还有可以将一样的放一起,如果一个在某个位置放不下了,那么其他的更放不下了. #include <stdio.h> #include <iostream> #include <string.h> using nam…
Exchange Cards Time Limit: 2 Seconds      Memory Limit: 65536 KB As a basketball fan, Mike is also fond of collecting basketball player cards. But as a student, he can not always get the money to buy new cards, so sometimes he will exchange with his…
Oil Deposits Time Limit: 2 Seconds      Memory Limit: 65536 KB The GeoSurvComp geologic survey company is responsible for detecting underground oil deposits. GeoSurvComp works with one large rectangular region of land at a time, and creates a grid th…
Generalized Palindromic Number Time Limit: 2 Seconds                                     Memory Limit: 65536 KB                             A number that will be the same when it is written forwards or backwards is known as a palindromic number. For…