![](https://img-blog.csdnimg.cn/20201014180756926.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
数据结构--树状数组
pxlsdz
冲就完了!
展开
-
牛客练习赛52
题号 标题 已通过代码 题解 讨论 通过率 我的状态 A 数数 点击查看 进入题解 进入讨论 281/1531 通过 B Galahad 点击查看 进入题解 进入讨论 144/799 通过 C 烹饪 点击查看 进入题解 进入讨论 50/184 ...原创 2019-10-25 10:39:48 · 225 阅读 · 0 评论 -
hdu 5124 BestCoder #20 1002 lines 离散化+(线段树。树状数组或区间覆盖)三种方法
linesTime Limit: 5000/2500 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1994 Accepted Submission(s): 869 Problem DescriptionJohn has several lines. The ...原创 2019-01-17 01:29:30 · 252 阅读 · 0 评论 -
POJ-2892/HDU-1540 Tunnel Warfare (树状数组+二分查找)
Tunnel WarfareTime Limit:1000MS Memory Limit:131072K Total Submissions:9766 Accepted:4048 DescriptionDuring the War of Resistance Against Japan, tunnel warfare was carried ...原创 2019-02-14 23:58:48 · 245 阅读 · 0 评论 -
POJ2155Matrix——二维树状数组模板
MatrixTime Limit: 3000MS Memory Limit: 65536KTotal Submissions: 20599 Accepted: 7673DescriptionGiven an N*N matrix A, whose elements are either 0 or 1. A[i, j] means the number in...原创 2019-02-17 22:10:57 · 216 阅读 · 0 评论 -
poj1195--Mobile phones(二维树状数组)
Mobile phonesTime Limit: 5000MS Memory Limit: 65536KTotal Submissions: 15182 Accepted: 7013DescriptionSuppose that the fourth generation mobile phone base stations in the Tampere ...原创 2019-02-17 22:17:36 · 199 阅读 · 0 评论 -
AtCoder Regular Contest 068
C - X: Yet Another Die GameTime Limit: 2 sec / Memory Limit: 256 MBScore :300300pointsProblem StatementSnuke has decided to play with a six-sided die. Each of its six sides shows an integ...原创 2019-05-30 16:35:13 · 360 阅读 · 0 评论 -
AtCoder Regular Contest 068 E - Snuke Line(好题:思维+树状数组 )
E - Snuke LineTime Limit: 2 sec / Memory Limit: 256 MBScore :700700pointsProblem StatementSnuke has decided to play a game, where the player runs a railway company. There areM+1M+1stations...原创 2019-05-30 16:36:34 · 385 阅读 · 0 评论 -
POJ2182 Lost Cows 树状数组 二分+树状数组(O(log^2n)/树状数组+倍增(O(logn))
244. 谜一样的牛 题目 提交记录 讨论 题解有n头奶牛,已知它们的身高为 1~n 且各不相同,但不知道每头奶牛的具体身高。现在这n头奶牛站成一列,已知第i头牛前面有AiAi头牛比它低,求每头奶牛的身高。输入格式第1行:输入整数n。第2..n行:每行输入一个整数AiAi,第i行表示第i头牛前面有AiAi头牛比它低。(注意:因为第1头...原创 2019-07-29 11:18:46 · 334 阅读 · 0 评论 -
2019年ICPC南昌网络赛 J. Distance on the tree(树链剖分+主席树 查询路径边权第k大)
DSM(Data Structure Master) once learned about tree when he was preparing for NOIP(National Olympiad in Informatics in Provinces) in Senior High School. So when in Data Structure Class in College, he i...原创 2019-07-30 15:45:24 · 294 阅读 · 0 评论 -
线段树/树状数组复习总结 (未完待续)
线段树的遇到的题型主要分为两种:思维+线段树/树状数组、线段树的修改结构、扫描线。第一种:思维+线段树,线段树不是难点,关键如何应用线段树或者该运用线段树的解决什么问题。例题:4302 Interval GCD 线段树 +树状数组 线段树维护数组区间GCD 数学知识点:gcd ( x,y,z )= gcd( x,y-x,z-y );可继续扩展到n元HDU ...原创 2019-08-05 21:41:50 · 156 阅读 · 0 评论 -
HDU 5877 Weak Pair 【dfs】【树状数组】【离散化】
Weak PairTime Limit: 4000/2000 MS (Java/Others)Memory Limit: 262144/262144 K (Java/Others)Total Submission(s): 5985Accepted Submission(s): 1683Problem DescriptionYou are given aroote...原创 2019-08-17 11:18:51 · 134 阅读 · 0 评论 -
2017 ACM-ICPC 亚洲区(乌鲁木齐赛区)网络赛-G: Query on a string (KMP+树状数组)
You have two stringsSSandTTin all capitals.Now an efficient program is required to maintain a operation and support a query.The operationC~i~chCichwith given integeriiand capital letter...原创 2019-08-27 09:41:45 · 254 阅读 · 0 评论 -
2019ICPC南京网络赛 A.The beautiful values of the palace 离线树状数组或者CDQ分治或者主席树
Here is a square matrix ofn * nn∗n, each lattice has its value (nnmust be odd), and the center value isn * nn∗n. Its spiral decline along the center of the square matrix (the way of spiral decline ...原创 2019-09-26 15:00:51 · 194 阅读 · 0 评论 -
2019icpc南昌网络赛 G. Colorful String 回文自动机+区间种类数(树状数组)The Preliminary Contest for ICPC Asia Xuzhou 2019
The value of a stringssis equal to the number of different letters which appear in this string.Your task is to calculate the total value of all the palindrome substring.InputThe input consists...原创 2019-09-07 21:14:56 · 224 阅读 · 0 评论 -
Lightoj 1112 - Curious Robin Hood (树状数组:单点修改 + 区间查询)
1112 - Curious Robin Hood PDF (English) Statistics ForumTime Limit: 1 second(s) Memory Limit: 64 MBRobin Hood likes to loot rich people since he helps the poor people with this money. I...原创 2019-01-16 20:39:25 · 311 阅读 · 0 评论 -
HDU 5493 Queue(二分+树状数组)
QueueTime Limit: 4000/2000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 1539 Accepted Submission(s): 792 Problem DescriptionN people numbered from 1 to ...原创 2019-01-15 19:54:46 · 445 阅读 · 0 评论 -
HDU-4000 Fruit Ninja 树状数组+思维
Fruit NinjaTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 3634 Accepted Submission(s): 1109 Problem DescriptionRecently, dobby is ad...原创 2019-01-23 19:23:22 · 307 阅读 · 0 评论 -
HDU 1166 敌兵布阵(树状数组模板题)
敌兵布阵Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 127082 Accepted Submission(s): 53280 Problem DescriptionC国的死对头A国这段时间正在进行军事演习,所以C国...原创 2018-10-28 21:38:05 · 231 阅读 · 0 评论 -
UVA1428 Ping pong(树状数组+思维)
题意翻译一条大街上住着nn个乒乓球爱好者,经常组织比赛切磋技术。每个人都有一个不同的技能值a_{i}ai。每场比赛需要33个人:两名选手,一名裁判。他们有一个奇怪的规定,即裁判住在两名选手中间,并且技能值也在两名选手之间。问一共能组织多少种比赛。题目描述PDF‘输入输出格式输入格式: 输出格式: 输入输出样例暂无测试点算法分析:题意: ...原创 2018-10-29 00:04:29 · 334 阅读 · 0 评论 -
北京化工大学2018年10月程序设计竞赛 问题 D: 积木 树状数组
问题 D: 积木时间限制: 1 Sec 内存限制: 128 MB提交: 503 解决: 49[提交] [状态] [讨论版] [命题人:admin] 题目描述我懒得编故事了 m哥牛逼!有n个积木,第i个积木的高度为a[i],求每个积木前面有几个比它矮的积木 输入多组输入,每组由两行组成,第一行输入n,第二行输入n个数,为n个积木的高度a[i]//(1<...原创 2018-10-29 00:44:58 · 508 阅读 · 0 评论 -
Poj 2352 Stars(树状数组)
Stars Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 55490 Accepted: 23840 DescriptionAstronomers often examine star maps where stars...原创 2018-11-15 23:49:56 · 197 阅读 · 0 评论 -
POJ2182 Lost Cows 树状数组
Lost Cows Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 13107 Accepted: 8398 Descript...原创 2018-11-14 23:26:32 · 232 阅读 · 0 评论 -
TYVJ1432 楼兰图腾 树状数组
描述在完成了分配任务之后,西部314来到了楼兰古城的西部。相传很久以前这片土地上(比楼兰古城还早)生活着两个部落,一个部落崇拜尖刀(‘V’),一个部落崇拜铁锹(‘∧’),他们分别用V和∧的形状来代表各自部落的图腾。西部314在楼兰古城的下面发现了一幅巨大的壁画,壁画上被标记出了N个点,经测量发现这N个点的水平位置和竖直位置是两两不同的。西部314认为这幅壁画所包含的信息与这N个点的相对位置有...原创 2019-01-10 13:59:44 · 204 阅读 · 0 评论 -
POJ 2481 Cows(树状数组:区间真子集的个数)
CowsTime Limit: 3000MS Memory Limit: 65536K Total Submissions: 23460 Accepted: 7898 DescriptionFarmer John's cows have discovered that the clover growing along the ridge of the...原创 2019-01-10 15:45:27 · 295 阅读 · 0 评论 -
hdu3450Counting Sequences DP+树状数组
Counting Sequences Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/65536 K (Java/Others) Total Submission(s): 3012 Accepted Submission(s): 1067 Problem Descripti...原创 2019-01-10 21:44:20 · 214 阅读 · 0 评论 -
2019.1.10
终于考完试了,可以好好打敲代码了。 今天复习了树状数组,一开始刷题还蛮顺的,但到下午的一个DP+树状数组的看了好久,到现在还云里雾里,回来还得好好领悟领悟。 这几天打算把数据结构复习复习,忘的都差不多了。向一个合格的ACMer进发。...原创 2019-01-10 22:08:13 · 151 阅读 · 0 评论 -
HDOJ5542-The Battle of Chibi【详细解释树状数组优化dp】
The Battle of Chibi Time Limit: 6000/4000 MS (Java/Others) Memory Limit: 65535/65535 K (Java/Others) Total Submission(s): 3091 Accepted Submission(s): 1117 Problem Description...原创 2019-01-11 11:42:05 · 478 阅读 · 0 评论 -
CF597C. Subsequences [dp树状数组优化]
题意翻译题目描述输入一个1~n的排列, 以及一个正整数k, 求该排列种有多少个长度为k+1的上升子序列. 保证答案小于8乘10的18次方.输入格式第一行输入两个正整数n和k接下来n行每行一个正整数描述输入的排列输出格式输出一个数表示答案.题目描述For the given sequence with nn different elements find the ...原创 2019-01-11 12:10:11 · 357 阅读 · 0 评论 -
HDU 1394 Minimum Inversion Number(线段树:单点更新,区间求和或树状数组:求逆序对)
The inversion number of a given number sequence a1, a2, ..., an is the number of pairs (ai, aj) that satisfy i < j and ai > aj. For a given sequence of numbers a1, a2, ..., an, if w...原创 2019-01-12 16:10:24 · 226 阅读 · 3 评论 -
POJ 2828 Buy Tickets(线段树:查找并更新从左到右第i个1或树状数组:统计1的个数)
Buy TicketsTime Limit: 4000MS Memory Limit: 65536K Total Submissions: 25204 Accepted: 12130 DescriptionRailway tickets were difficult to buy around the Lunar New Year in China,...原创 2019-01-13 01:08:31 · 179 阅读 · 0 评论 -
树状数组(二叉索引树)
树状数组的原理介绍可见刘汝佳《算法竞赛入门经典:训练指南》194页,讲的非常好简单自己对树状数组的基本理解:我们原先不是把数组看成一排吗,但现在不是了,我们用一个类似二叉树的结构来保存数据,存到c当中去,好好研究刘汝佳所画的图。下面说明基本应用对于一个n元素的数组A[n],可执行如下操作:Add(I, d):让A[i]变成A[i]+d。...原创 2018-10-28 21:35:01 · 338 阅读 · 0 评论