- 博客(15)
- 收藏
- 关注
原创 洛谷_P2586 [ZJOI2008]杀蚂蚁(模拟)
[ZJOI2008]杀蚂蚁题目链接:https://www.luogu.com.cn/problem/P2586题意模拟题,题意太长,直接读题吧。题解:大模拟。按照题目要求写就好,中间套了点计算几何。设结构体维护每个蚂蚁的信息,因为总数较少,所以删除某个点的时候直接把后面的点前移就好了。对于每个事件,写个函数就好了。注意严格按照题目说的做。注意一些坑点,蚂蚁不动也可以拿到蛋糕。#in...
2019-12-30 20:13:28 306
原创 POJ_1286 Necklace of Beads(Polya)
Necklace of BeadsTime Limit: 1000MS Memory Limit: 10000KProblem DescriptionBeads of red, blue or green colors are connected together into a circular necklace of n beads ( n < 24 ). If the repe...
2019-12-29 14:21:07 143
原创 洛谷_P1191 矩形(单调栈 || 暴力)
矩形题目链接:https://www.luogu.com.cn/problem/P1191题意有一个n*n的字符矩阵,每个位置为’B’或’W’,求’W’形成的矩阵的数量。题解:设h[i][j]h[i][j]h[i][j],代表第i行,第j列,向上有多少个连续的’W’。思路一:单调栈。对于每一行,维护一个递增的单调栈,每个维护高度和这个高度的列的数量。然后对于h[i][j]h[i][j]...
2019-12-27 21:02:36 395
原创 洛谷_P4949 最短距离(树链剖分+RMQ)
最短距离题目链接:https://www.luogu.com.cn/problem/P4949题意有一个n个点n条边的无向连通图,每次可以修改一条边的权值或者询问两点间的最短距离。给出每个询问的答案。题解:n个点n条边的无向连通图,则一定会有n-1条边组成一棵树,另一条边单独记录处理。对于任意两点(s,t)之间的最短距离,一定是从树上走那条唯一路径,或者经过单独记录的那条边。设多余的那条...
2019-12-27 16:18:20 500 1
原创 洛谷_P4301 新Nim游戏(线性基)
新Nim游戏题目链接:https://www.luogu.com.cn/problem/P4301题意有n堆火柴,第一次操作第一个人可以直接拿走若干个整堆的火柴,但不能拿完所有堆,第二次操作第二个人可以直接拿走若干个整堆的火柴,同样也不能拿完。之后两个人进行Nim博弈,问在保证第一个人必胜的情况下,第一回合最少拿多少根火柴。题解:经过思考可以发现,第一个人是必胜的,只要第一回合结束后,留...
2019-12-26 20:13:15 135 1
原创 CodeForces 1268C K Integers(线段树/树状数组)
K Integerstime limit per test:3 secondsmemory limit per test:256 megabytesProblem DescriptionYou are given a permutation p1,p2,…,pn.In one move you can swap two adjacent values.You want to perfo...
2019-12-24 15:39:32 315
原创 CodeForces 1076E Vasya and a Tree(DFS)
Vasya and a Treetime limit per test:2 secondsmemory limit per test:256 megabytesProblem DescriptionVasya has a tree consisting of n vertices with root in vertex 1. At first all vertices has 0 writ...
2019-12-23 21:44:11 121
原创 CodeForces 1268A Long Beautiful Integer(贪心)
Long Beautiful Integertime limit per test:3 secondsmemory limit per test:256 megabytesProblem DescriptionYou are given an integer x of n digits a_1_,a_2_,…,a_n_, which make up its decimal notation...
2019-12-22 13:57:23 283
原创 hdu 6411 带劲的and和(并查集、位运算)
带劲的and和Time Limit: 2000/1000 MS (Java/Others) Memory Limit:65536/65536 K (Java/Others)Problem Description度度熊专门研究过“动态传递闭包问题”,他有一万种让大家爆蛋的方法;但此刻,他只想出一道简简单单的题——至繁,归于至简。度度熊有一张n个点m条边的无向图,第i个点的点权为vi...
2019-12-11 15:40:43 91 1
原创 hdu 5838 Mountain(状压dp+容斥原理)
MountainTime Limit: 3000/1500 MS (Java/Others) Memory Limit:65536/65536 K (Java/Others)Problem DescriptionZhu found a map which is a N∗M rectangular grid.Each cell has a height and there are no...
2019-12-10 09:19:08 201
原创 Codeforces 1264C Beautiful Mirrors with queries(线段树+期望)
Beautiful Mirrors with queriestime limit per test:2 secondsmemory limit per test:256 megabytesProblem DescriptionCreatnx has n mirrors, numbered from 1 to n. Every day, Creatnx asks exactly one mi...
2019-12-08 12:03:44 306
原创 Yuuki and a problem
Yuuki and a problem题目连接:https://nanti.jisuanke.com/t/42552题意有一棵树,以1号节点为根,求以每个节点为根的子树的重心。题解:题目其实给的一个公式,可以发现就是树的重心的第一个式子。而且题目输出要求说如果有两个中间需要空格分隔,就已经暗示的很明显了是求树的重心。求树的重心可以利用树的重心的性质来求。#include<cstd...
2019-12-07 22:19:12 269
原创 CodeForces 1265E Beautiful Mirrors(数学期望)
Beautiful Mirrorstime limit per test:2 secondsmemory limit per test:256 megabytesProblem DescriptionCreatnx has n mirrors, numbered from 1 to n. Every day, Creatnx asks exactly one mirror “Am I be...
2019-12-06 22:03:53 264
原创 CodeForces 1065F Up and Down the Tree(BFS+DFS)
Up and Down the Treetime limit per test:3 secondsmemory limit per test:256 megabytesProblem DescriptionYou are given a tree with n vertices; its root is vertex 1. Also there is a token, initially ...
2019-12-05 15:04:54 206
原创 POJ 2826 An Easy Problem?!(计算几何)
An Easy Problem?!Time Limit: 1000MS Memory Limit: 65536KProblem DescriptionIt’s raining outside. Farmer Johnson’s bull Ben wants some rain to water his flowers. Ben nails two wooden boards on the...
2019-12-03 22:17:49 168
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人