随笔分类 -  数据结构之树状数组

摘要:"bzoj2434" 阿狸喜欢收藏各种稀奇古怪的东西,最近他淘到一台老式的打字机。打字机上只有28个按键,分别印有26个小写英文字母和'B'、'P'两个字母。 经阿狸研究发现,这个打字机是这样工作的: l 输入小写字母,打字机的一个凹槽中会加入这个字母(这个字母加在凹槽的最后)。 l 按一下印有'B 阅读全文
posted @ 2018-07-11 10:40 walfy 阅读(175) 评论(0) 推荐(0) 编辑
摘要:链接 毒瘤场..... A题:,真码农题,直接干爆,枚举,注意越界问题,wa37的看这组数据1 10 1 5 2 2,应该是no //#pragma comment(linker, "/stack:200000000") //#pragma GCC optimize("Ofast,no-stack- 阅读全文
posted @ 2018-02-06 20:32 walfy 阅读(199) 评论(0) 推荐(0) 编辑
摘要:A:水题 #include<bits/stdc++.h> #define fi first #define se second #define mp make_pair #define pb push_back #define pi acos(-1.0) #define ll long long # 阅读全文
posted @ 2017-12-21 23:25 walfy 阅读(210) 评论(0) 推荐(0) 编辑
摘要:题意:求所有子区间的逆序数对数之和 题解:树状数组维护,对于每一对逆序数(l,r)属于l*(n-r+1)个区间,计算每一对对结果的贡献即可,可用树状数组维护,sum维护(n-r+1),按逆序数那样操作 这题最狗的地方是爆longlong,java又超时。。。,用了一个小技巧,避免爆longlong 阅读全文
posted @ 2017-12-02 01:49 walfy 阅读(338) 评论(0) 推荐(0) 编辑
摘要:这题想了很久没思路,不知道怎么不sort维护二维的最小值 emmmm原来是线段树/树状数组,一维sort,二维当成下标,维护三维的最小值 #include<bits/stdc++.h> #define fi first #define se second #define mp make_pair # 阅读全文
posted @ 2017-09-28 13:49 walfy 阅读(216) 评论(0) 推荐(0) 编辑
摘要:During several decades, scientists from planet Nibiru are working to create an engine that would allow spacecrafts to fall into hyperspace and move th 阅读全文
posted @ 2017-05-15 16:48 walfy 阅读(188) 评论(0) 推荐(0) 编辑
摘要:Japan plans to welcome the ACM ICPC World Finals and a lot of roads must be built for the venue. Japan is tall island with N cities on the East coast 阅读全文
posted @ 2017-05-03 14:29 walfy 阅读(165) 评论(0) 推荐(0) 编辑
摘要:Suppose that the fourth generation mobile phone base stations in the Tampere area operate as follows. The area is divided into squares. The squares fo 阅读全文
posted @ 2017-05-03 11:47 walfy 阅读(163) 评论(0) 推荐(0) 编辑
摘要:Given an N*N matrix A, whose elements are either 0 or 1. A[i, j] means the number in the i-th row and j-th column. Initially we have A[i, j] = 0 (1 <= 阅读全文
posted @ 2017-05-03 11:16 walfy 阅读(154) 评论(0) 推荐(0) 编辑
摘要:Every year, Farmer John's N (1 <= N <= 20,000) cows attend "MooFest",a social gathering of cows from around the world. MooFest involves a variety of e 阅读全文
posted @ 2017-04-27 19:58 walfy 阅读(152) 评论(0) 推荐(0) 编辑
摘要:Astronomers often examine star maps where stars are represented by points on a plane and each star has Cartesian coordinates. Let the level of a star 阅读全文
posted @ 2017-04-24 18:46 walfy 阅读(220) 评论(0) 推荐(0) 编辑
摘要:C国的死对头A国这段时间正在进行军事演习,所以C国间谍头子Derek和他手下Tidy又开始忙乎了。A国在海岸线沿直线布置了N个工兵营地,Derek和Tidy的任务就是要监视这些工兵营地的活动情况。由于采取了某种先进的监测手段,所以每个工兵营地的人数C国都掌握的一清二楚,每个工兵营地的人数都有可能发生 阅读全文
posted @ 2017-04-24 18:43 walfy 阅读(167) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示