sample input 9 10 0 1 1 3 2 4 3 2 3 6 5 4 6 5 7 5 8 6 8 7 sample output 0 1 3 2 8 6 7 5 4 0 1 3 2 8 7 6 5 4 0 1 3 8 2 6 7 5 4 0 1 3 8 2 7 6 5 4 0 1 3 ...
分类:
编程语言 时间:
2020-04-17 18:35:52
阅读次数:
105
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2553 Problem Description 在N*N的方格棋盘放置了N个皇后,使得它们不相互攻击(即任意2个皇后不允许处在同一排,同一列,也不允许处在与棋盘边框成45角的斜线上。你的任务是,对于给定的 ...
分类:
其他好文 时间:
2020-04-16 19:23:08
阅读次数:
70
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4785 题意:一个房间(矩形),里面有一些家具(凸多边形),你有一个扫地机器(凸多边形),扫地机器可以扫地是它的第一个点,能扫地条件是机器完全在房间里面并且和家具没有交(机器可以穿过家具,但穿过的时候不能 ...
分类:
其他好文 时间:
2020-04-16 15:40:44
阅读次数:
86
一.题解 ? 这道题又是一道换根dp板子题,代码结构与 "Accumulation Degree" 这道题基本一致,唯一不同的就是转移了【不过转移的时候,因为方程的原因不需要特殊考虑叶节点】 ? 我们先套路的设$dp[i]$ 表示以 $i$ 为根的子树中 , 所有点的深度和 ,现在,我们来想想转移。 ...
分类:
其他好文 时间:
2020-04-13 12:33:24
阅读次数:
53
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1789 Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Problem Descripti ...
分类:
其他好文 时间:
2020-04-12 19:01:30
阅读次数:
77
``` #include #define f first #define s second using namespace std; typedef long long ll; const int N=300005; typedef pair P; int n,tot,t,V; map mp; ma... ...
分类:
其他好文 时间:
2020-04-12 18:18:38
阅读次数:
100
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4612 题意:给定一个无向图,问加一条边后最少的桥数是多少。 思路:找出边双连通分量后缩点成一棵树,然后我们要是加一条边使桥数最少,显然是去找树的直径,所以两边DFS去找树的直径即可,注意这里很坑,重边是 ...
分类:
其他好文 时间:
2020-04-11 23:30:08
阅读次数:
65
Problem Description Give you the width and height of the rectangle,darw it. Input Input contains a number of test cases.For each case ,there are two n ...
分类:
其他好文 时间:
2020-04-11 23:29:43
阅读次数:
97
题目链接http://acm.hdu.edu.cn/showproblem.php?pid=5963 吐槽 这道题我第一眼看,嗯??博弈论?还是树上的?我好像不会啊。。。但是一想某人的话,感觉这个应该也不会太难,可能有规律 分析 于是我就从样例开始仔细思考~~找规律~~,第一个样例应该是看不出来啥, ...
分类:
其他好文 时间:
2020-04-11 22:09:21
阅读次数:
63
完全平方数 + 题目链接: "https://ac.nowcoder.com/acm/contest/37/A" 涉及知识点: + 暴力/二分 solution: + $祝大家周末愉快$ + $[1,n]区间的完全平方数的个数等于$ $\sqrt{n}$ + $[L,R]区间的完全平方数的个数可以理 ...
分类:
其他好文 时间:
2020-04-11 10:18:41
阅读次数:
63