HDU.1166 敌兵布阵 (线段树 单点更新 区间查询) 题意分析 加深理解,重写一遍 代码总览 #include <bits/stdc++.h> #define nmax 100000 using namespace std; struct Tree{ int l,r,val; int lazy; int mid(){ return (l+r)>>1; } }; Tree tree[nmax<<2]; int num[nmax<<2]; void Pus…
Billboard Time Limit: 1 Sec  Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=2795 Description At the entrance to the university, there is a huge rectangular billboard of size h*w (h is its height and w is its width). The board is…
RMQ with Shifts 时间限制:1000 ms  |  内存限制:65535 KB 难度:3 ->  Link1  <- -> Link2  <- 以上两题题意是一样的,只不过数据范围有所改动,代码改一下数组大小直接水过: 思路:典型的线段数单点更新+区间查询,只不过题目改动了一下,没有直接给出更新数据和查询区间,而是用字符串输入,所以只能将数据提取出来再进行操作,这道题线段数能做那么用RMQ肯定也能做,而且可能还更简洁:过的人并不多,大神们快点去A了它吧: #inclu…
单点更新 区间查询 #include <bits/stdc++.h> using namespace std; #define m ((l+r)/2) #define ls (rt<<1) #define rs (rt<<1|1) ; int s[N], tr[N]; void build(int rt,int l,int r) { if(l == r) { tr[rt] = s[l]; return ; } build(ls, l, m); build(rs, m+,…
敌兵布阵 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 73866    Accepted Submission(s): 30997 Problem Description C国的死对头A国这段时间正在进行军事演习,所以C国间谍头子Derek和他手下Tidy又开始忙乎了.A国在海岸线沿直线布置了N个工兵营地,Derek和Tidy的任务…
Conturbatio Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=5480 Description There are many rook on a chessboard, a rook can attack the row and column it belongs, including its own place. There are also many quer…
I Hate It Time Limit: 9000/3000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 76994    Accepted Submission(s): 29632 Problem Description 很多学校流行一种比较的习惯.老师们很喜欢询问,从某某到某某当中,分数最高的是多少.这让很多学生很反感. 不管你喜不喜欢,现在需要你做的是,就是按照老师的要…
LCIS Given n integers. You have two operations: U A B: replace the Ath number by B. (index counting from 0) Q A B: output the length of the longest consecutive increasing subsequence (LCIS) in [a, b].                  Input T in the first line, indic…
敌兵布阵 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 62483    Accepted Submission(s): 26386 Problem Description C国的死对头A国这段时间正在进行军事演习,所以C国间谍头子Derek和他手下Tidy又开始忙乎了.A国在海岸线沿直线布置了N个工兵营地,Derek和Tidy的任务就…
H - 秋实大哥与线段树 Time Limit:1000MS     Memory Limit:65535KB     64bit IO Format:%lld & %llu Submit Status Practice UESTC 1073 Appoint description:  System Crawler  (2016-04-24) Description “学习本无底,前进莫徬徨.” 秋实大哥对一旁玩手机的学弟说道. 秋实大哥是一个爱学习的人,今天他刚刚学习了线段树这个数据结构. 为…