FOJ 1608 Huge Mission 线段树】的更多相关文章

每个节点维护一个最小值,更新发现如果大于最小值,直接向下更新.速度还可以.. #include<cstdio> #include<algorithm> #include<iostream> #include<cstring> #include<vector> #include<stack> #include<cmath> #include<queue> #include<map> using nam…
Problem 1608 Huge Mission Time Limit: 1000 mSec    Memory Limit : 32768 KB Problem Description Oaiei is busy working with his graduation design recently. If he can not complete it before the end of the month, and he can not graduate! He will be very…
题目链接: https://cn.vjudge.net/problem/FZU-1608 题目大意: 长度n,m次操作:每次操作都有三个数:a,b,c:意味着(a,b]区间单位长度的价值为c,若某段长度不曾被操作,则意味着该长度价值为0,若有一段长度有多个价值,则选取最大的.(多组输入)请输出(0,n]内最大价值和. 解题思路: 直接进行懒惰标记更新即可. 然后再直接处理出每个数字最大值即可.也就是不断pushdown懒惰标记直到每个叶子节点,这样叶子节点的懒惰标记一定是最大值. #includ…
Huge Mission Time Limit: 1000ms Memory Limit: 32768KB This problem will be judged on FZU. Original ID: 160864-bit integer IO format: %I64d      Java class name: Main Oaiei is busy working with his graduation design recently. If he can not complete it…
一.题目 Huge Mission 二.分析 区间更新,用线段树的懒标记即可.需要注意的时,由于是在最后才查询的,没有必要每次更新都对$sum$进行求和.还有一点就是初始化的问题,一定记得线段树上每个点都需要初始化. 三.AC代码 1 #include <cstdio> 2 #include <cstring> 3 #include <iostream> 4 #include <algorithm> 5 #include <vector> 6 #…
传送门:Huge Mission 题意:给定区间范围[0,N] (2 <= N <= 50000)和M个区间 (1 <= M <= 500000)和这些区间上的权值,求最终并区间的最大权值总和(某个区间不能被计算两次). 分析:线段树区间维护最值,最后pushdown下去取每点的最大值. #include<iostream> #include<cstdio> #include<cstring> #include<algorithm>…
题目链接:https://icpcarchive.ecs.baylor.edu/index.php?option=com_onlinejudge&Itemid=8&category=648&page=show_problem&problem=5153 In an infinite chess board, some pawns are placed on some cells.You have a rectangular bomb that is W width and H…
I Hate It Time Limit: 9000/3000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 33726    Accepted Submission(s): 13266 Problem Description 很多学校流行一种比较的习惯.老师们很喜欢询问,从某某到某某当中,分数最高的是多少.这让很多学生很反感. 不管你喜不喜欢,现在需要你做的是,就是按照老师的要…
I Hate It hdu1754 Time Limit: 9000/3000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 18466    Accepted Submission(s): 7172 Problem Description 很多学校流行一种比较的习惯.老师们很喜欢询问,从某某到某某当中,分数最高的是多少.这让很多学生很反感. 不管你喜不喜欢,现在需要你做的是,就…
Stars Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 37323 Accepted: 16278 Description 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 b…