FZU 1608 Huge Mission(线段树)】的更多相关文章

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…
每个节点维护一个最小值,更新发现如果大于最小值,直接向下更新.速度还可以.. #include<cstdio> #include<algorithm> #include<iostream> #include<cstring> #include<vector> #include<stack> #include<cmath> #include<queue> #include<map> using nam…
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…
题目链接: https://cn.vjudge.net/problem/FZU-1608 题目大意: 长度n,m次操作:每次操作都有三个数:a,b,c:意味着(a,b]区间单位长度的价值为c,若某段长度不曾被操作,则意味着该长度价值为0,若有一段长度有多个价值,则选取最大的.(多组输入)请输出(0,n]内最大价值和. 解题思路: 直接进行懒惰标记更新即可. 然后再直接处理出每个数字最大值即可.也就是不断pushdown懒惰标记直到每个叶子节点,这样叶子节点的懒惰标记一定是最大值. #includ…
Problem 2105 Digits Count Accept: 302 Submit: 1477 Time Limit: 10000 mSec Memory Limit : 262144 KB Problem Description Given N integers A={A[0],A[1],-,A[N-1]}. Here we have some operations: Operation 1: AND opn L R Here opn, L and R are integers. For…
http://acm.fzu.edu.cn/problem.php?pid=2105 Problem Description Given N integers A={A[0],A[1],...,A[N-1]}. Here we have some operations: Operation 1: AND opn L R Here opn, L and R are integers. For L≤i≤R, we do A[i]=A[i] AND opn (here "AND" is bi…
一.题目 Huge Mission 二.分析 区间更新,用线段树的懒标记即可.需要注意的时,由于是在最后才查询的,没有必要每次更新都对$sum$进行求和.还有一点就是初始化的问题,一定记得线段树上每个点都需要初始化. 三.AC代码 1 #include <cstdio> 2 #include <cstring> 3 #include <iostream> 4 #include <algorithm> 5 #include <vector> 6 #…
 FZU 2105  Digits Count Time Limit:10000MS     Memory Limit:262144KB     64bit IO Format:%I64d & %I64u Practice Description Given N integers A={A[0],A[1],...,A[N-1]}. Here we have some operations: Operation 1: AND opn L R Here opn, L and R are intege…
题目链接: F - Change FZU - 2277 题目大意: 题意: 给定一棵根为1, n个结点的树. 有q个操作,有两种不同的操作 (1) 1 v k x : a[v] += x, a[v '] += x – k(v '为v的儿子), a[v ' '] += x – 2 * k(v ' '是v '的儿子) ... ; (2) 2 v : 输出a[v] % (1e9 + 7); 具体思路:dfs序+线段树 a[v'']=a[v'']+x-k*(depth[v'']-depth[v])=a[…
[题目链接] http://acm.fzu.edu.cn/problem.php?pid=2105 [题目大意] 给出一个序列,数字均小于16,为正数,每次区间操作可以使得 1. [l,r]区间and一个数 2. [l,r]区间or一个数 3. [l,r]区间xor一个数 4. [l,r]区间查询和 操作数均为小于16的非负整数 [题解] 由于操作数很小,因此我们可以按位维护四棵线段树,表示二进制中的第i位, 对于and操作,只有当and的当前位为0时才对区间有影响,效果是将区间全部变为0, 对…