- 博客(15)
- 收藏
- 关注
原创 Cyclic Shifts Sorting
You are given an array a consisting of n integers.In one move, you can choose some index i(1≤i≤n−2)i (1≤i≤n−2)i(1≤i≤n−2) and shift the segment [ai,ai+1,ai+2][a_i,a_{i+1},a_{i+2}][ai,ai+1,ai+2] cyclically to the right (i.e. replace the segment [ai,ai+1,
2020-06-30 10:40:43 347
原创 Postman
A postman delivers letters to his neighbors in a one-dimensional world.The post office, which contains all of the letters to begin with, is located at x=0x = 0x=0, and there aren houses to which the postman needs to deliver the letters. House iii is locat
2020-06-20 19:31:38 305
原创 Barbells
Your local gym has n barbells and m plates. In order to prepare a weight for lifting, you mustchoose a single barbell, which has two sides. You then load each side with a (possibly empty) setof plates. For safety reasons, the plates on each side must sum t
2020-06-20 19:23:51 257
原创 Illumination
You inherited a haunted house. Its floor plan is an nnn-by-nnn square grid with lll lamps in fixedlocations and no interior walls. Each lamp can either illuminate its row or its column, but not bothsimultaneously. The illumination of each lamp extends by r
2020-06-20 19:12:07 375
原创 Task On The Board
Polycarp wrote on the board a string sss containing only lowercase Latin letters (‘a’-‘z’). This string is known for you and given in the input.After that, he erased some letters from the string sss, and he rewrote the remaining letters in any order. As a
2020-06-17 16:13:22 280
原创 Ehabs Last Corollary
Given a connected undirected graph with nnn vertices and an integer kkk, you have to either:either find an independent set that has exactly ⌈k2⌉⌈\frac{k}{2}⌉⌈2k⌉ vertices.or find a simple cycle of length at most kkk.An independent set is a set of ver
2020-06-14 15:24:19 264
原创 Swapping Places
Animals are waiting in a line, in a quarantine zone, before they can enter a hunting-free area, where they will find an easier life.When entering the quarantine zone, animals have to check in with a guard. The guard writes down the animal species, and the
2020-06-14 11:14:34 314
原创 Ehab and Prefix MEXs
Given an array aaa of length nnn, find another array, bbb, of length nnn such that:for each i (1≤i≤n) MEX(b1,b2,…,bi)=aii \ (1≤i≤n)\ MEX({b_1, b_2, …, b_i})=a_ii (1≤i≤n) MEX(b1,b2,…,bi)=ai.The MEXMEXMEX of a set of integers is the
2020-06-14 09:55:35 199
原创 Birdwatching
Kiara studies an odd species of birds that travel in a very peculiar way. Their movements are best explained using the language of graphs: there exists a directed graph GGG where the nodes are trees, and a bird can only fly from a tree TaT_aTa to TbT_bTb
2020-06-13 22:56:37 289
原创 Practice for KD Tree
链接:https://ac.nowcoder.com/acm/problem/201927来源:牛客网题目描述It’s time to have a break and implement something.You are given an n×nn\times nn×n matrix A{A}A. All the elements are zero initially.First, you need to perform m1m_1m1 range addition operations.
2020-06-11 00:25:02 214
原创 城市排水
在一个n×nn×nn×n的方块城市中,坐标为(i,j)(i,j)(i,j)的位置高度为h[i,j]h[i,j]h[i,j],有mmm个排水井,分别位于(xi,yi)(x_i,y_i)(xi,yi)在一场大雨中,每个位置的水都会往相邻的积水更低的地方流动,如果无法排出将越积越高排水井处永远不会积水,水不会通过城市边缘排出(可以理解为城市边缘是无限高的墙)求每个位置的积水深度输入描述第一行输入一个整数TTT,代表有TTT组测试数据 对于每一组测试数据,第一行输入222个整数n,mn,mn,m,接下
2020-06-08 19:30:29 407
原创 选根
有一颗有nnn个结点树,结点被编号为111~nnn,记根结点深度为111,如果第iii个结点的深度是ddd,则它贡献的价值是d×wid\times{w_i}d×wi ,这棵树的价值是所有结点的价值和 求当根结点为111~nnn时,树的价值分别为多少输入描述第一行输入一个整数TTT,代表有TTT组测试数据 对于每一组测试数据,第一行有111个整数nnn,第二行有nnn个整数wiw_iwi,接下来n−1n-1n−1行每行有两个整数x,yx,yx,y表示xxx和yyy之间有一条边输出描述对于每组测试
2020-06-08 13:11:11 191
原创 再来异或
给你具有nnn个结点n−1n-1n−1条边的无向无环连通图,结点编号1∼n1 \sim n1∼n,每条边上有一个数作为他的边权,定义函数f(i,j)f(i,j)f(i,j)为连接i,ji,ji,j的简单路径的所有边权的异或值求⨁i=1n⨁j=inf(i,j)\displaystyle \bigoplus_{i=1}^n \bigoplus_{j=i}^n f(i,j)i=1⨁nj=i⨁nf(i,j),⊕\oplus⊕为按位异或运算,⨁i=lri\displaystyle \bigoplus_{i=l}
2020-06-07 19:40:25 226
原创 关键结点
一个含有nnn个结点mmm条边的无向有权图,判断每个结点是否在从111到nnn的最短路径上输入描述第一行输入一个整数TTT,代表有TTT组测试数据 对于每一组测试数据,第一行有222个整数n,mn,mn,m,接下来mmm行每行有333个整数xi,yi,wix_i,y_i,w_ixi,yi,wix ,表示xxx和yyy之间有一条权值为wiw_iwi 的边输出描述对于每组测试数据,在一行中输出nnn个整数,第iii个整数代表iii号结点的关键性000代表该结点不可能出现在从111到nnn的最短
2020-06-07 18:29:04 1357 2
原创 旅游
皮皮准备去旅游,共有nnn个景点可以选择,景点编号为111~nnn,每个景点都有一个“美观值”aia_iai。共有mmm次查询,对于第i次查询,皮皮将从xix_ixi号景点开始游览,之后他会选择沿着编号递增的顺序选择游览其他景点,但是如果这个景点的美观值不大于他刚刚游览过的景点,他就会跳过这个景点。也就是说,皮皮在游览一个美观值为uuu的景点vvv后,他将游览的下一个景点是编号大于vvv、美观值大于uuu的,编号最小的景点。皮皮将一共访问yiy_iyi 个景点,请你输出他最后一个访问的景点编号,如果他
2020-06-06 21:33:12 324
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人