http://acm.hdu.edu.cn/showproblem.php?pid=1540 Tunnel Warfare Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 3168    Accepted Submission(s): 1216 Problem Description During the War of Resistan…
Tunnel Warfare                                  Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Problem Description During the War of Resistance Against Japan, tunnel warfare was carried out extensively in the vast…
https://cn.vjudge.net/problem/HDU-1540 题意 D代表破坏村庄,R代表修复最后被破坏的那个村庄,Q代表询问包括x在内的最大连续区间是多少. 分析 线段树的区间内,我们要用三个变量记录左边连续区间,右边连续区间和最大连续区间. 其它看代码,要比较仔细. #include <iostream> #include <cstdio> #include <cstdlib> #include <cstring> #include &l…
Tunnel Warfare Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 11180    Accepted Submission(s): 4389 Problem Description During the War of Resistance Against Japan, tunnel warfare was carried ou…
题目链接 http://acm.hdu.edu.cn/showproblem.php?pid=1540 题意:D代表破坏村庄,R代表修复最后被破坏的那个村庄,Q代表询问包括x在内的最大连续区间是多少. 其实这题直接二分查找也可以,但用线段树可以练一练手. 大致思路就是找查询点最近的左右两个0的位置(0表示被摧毁的),然后输出区间大小即可,如果这个点已经被摧毁那么就没有 连续的区间,那么输出0.线段树查询位置有点麻烦具体看代码. #include <iostream> #include <…
Description During the War of Resistance Against Japan, tunnel warfare was carried out extensively in the vast areas of north China Plain. Generally speaking, villages connected by tunnels lay in a line. Except the two at the ends, every village was…
http://acm.hdu.edu.cn/showproblem.php?pid=1540 题目大意:抗日战争期间进行地道战,存在n个村庄用地道连接,输入D表示破坏某个村庄(摧毁与其相连的地道, 包括其本身),输入R表示重建最后被破坏的那个村庄. 输入Q表示查询某村庄可通过地道到达多少个村庄(包含本身). 将题目理想化,即为找与某点直接或间接相连的有多少个点.即通过此点的线段的最大长度.当此点时破坏时默认为0.抽象为此过程后发现即为在线段上执行的操作,即线 段树知识点.分析:此点可能为孤立(0…
校赛,还有什么途径可以申请加入ACM校队?  Tunnel Warfare Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 6483    Accepted Submission(s): 2502 Problem Description During the War of Resistance Against Japan, tunnel…
题目链接:1540 Tunnel Warfare 以为单组输入 这个题多组输入 结构体记录每个区间左边和右边的连续区间 ms记录最大 在查询操作时: 1.这个点即将查询到右区间 看这个点 x 是否存在于右区间的ls 如果存在说明有可能 左区间的rs 和右区间的 ls 是连续的 这时候我们要考虑查询两个区间并且 值想加 查询 左区间的时候同理 #include<bits/stdc++.h> using namespace std; #define maxn 500010 struct ac{ i…
Tunnel Warfare Time Limit: 1 Sec  Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=1540 Description During the War of Resistance Against Japan, tunnel warfare was carried out extensively in the vast areas of north China Plain. Gene…