- 博客(4)
- 收藏
- 关注
原创 POJ 3169(差分约束 + spfa模板)
题意:n头牛。按照编号排成一排,ml个第一种条件(u, v, w)表示编号为u的牛跟编号为v的牛的距离<=w,md个第二种条件(u, v, w)表示编号为u的牛跟编号为v的牛的距离>=w,如果这n头无法排成队伍,则输出-1,如果牛1和牛n的距离无限远,则输出-2,否则则输出牛1和牛n之间的最大距离。思路:差分约束,差分约束实际上就是求解多个不等式,比如 a - b <= 2 b - c <= 5
2016-07-29 12:47:26 350
原创 HDU 5754 博弈(威佐夫博弈)
这个题除了皇后的可以套用一下威佐夫博弈以外其他的都可以找规律找出来,主要为了学习一下威佐夫博弈, 威佐夫博弈:给两堆石子,每次都可以从其中一堆石子中取n个石子或者从两堆石子中都取n个石子,最后将石子取完的获胜。 解是根据: int k = abs(n - m); n = (int)((double)k * (1.0 + sqrt(5.0)) / 2.0
2016-07-26 20:22:05 489
原创 CodeForces 165D Beard Graph(树链剖分)
树链剖分偏模板题。 #include #include #include #include #include #include #include using namespace std; const int maxn = 100000 + 7; const int INF = ~0U >> 1; typedef long long LL; typedef pair P; st
2016-07-20 16:26:58 454
原创 CodeForces 166B(凸包)
判断一下A所构成的凸包是不是跟总的凸包一样就可以了.. #include #include #include #include #include #include #include #include using namespace std; const int INF = ~0U >> 1; const int maxn = 200000 + 7; const int
2016-07-14 13:20:16 557
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人