POJ3468:A Simple Problem with Integers】的更多相关文章

A Simple Problem with Integers Time Limit: 5000MS   Memory Limit: 131072K Total Submissions: 149972   Accepted: 46526 题目链接:http://poj.org/problem?id=3468 Description: You have N integers, A1, A2, ... , AN. You need to deal with two kinds of operation…
浅谈分块:https://www.cnblogs.com/AKMer/p/10369816.html 题目传送门:http://poj.org/problem?id=3468 分块裸题.对于每个块记录权值和与加标记即可.详情见代码. 时间复杂度:\(O(n\sqrt{n})\) 空间复杂度:\(O(n)\) 代码如下: #include <cmath> #include <cstdio> using namespace std; typedef long long ll; cons…
You have N integers, A1, A2, ... , AN. You need to deal with two kinds of operations. One type of operation is to add some given number to each number in a given interval. The other is to ask for the sum of numbers in a given interval. Input The firs…
http://poj.org/problem?id=3468 实现一个线段树,能够做到区间修改和区间查询和. 明显板子题. #include<cstdio> #include<cmath> #include<algorithm> #include<cstring> #include<iostream> using namespace std; typedef long long ll; inline ll read(){ ll X=,w=; ;…
A Simple Problem with Integers Time Limit: 10000MS Memory Limit: 65536K Description You have N integers, A1, A2, - , AN. You need to deal with two kinds of operations. One type of operation is to add some given number to each number in a given interv…
A Simple Problem with Integers Case Time Limit: 2000MS Description You have N integers, A1, A2, ... , AN. You need to deal with two kinds of operations. One type of operation is to add some given number to each number in a given interval. The other i…
A Simple Problem with Integers Time Limit: 5000MS   Memory Limit: 131072K Total Submissions: 141093   Accepted: 43762 Case Time Limit: 2000MS Description You have N integers, A1, A2, ... , AN. You need to deal with two kinds of operations. One type o…
http://poj.org/problem?id=3468 (题目链接) 题意 给出一个序列,要求维护区间修改与区间求和操作. Solution 多年以前学习的树状数组区间修改又忘记了→_→. 其实就是用树状数组维护一个差分序列${delta[i]}$,${delta[x]}$记录${[i,n]}$中每一个数的增量,每次修改${[l,r]}$就转化为了${delta[l]+=d,delta[r+1]-=d}$. 对于求和操作${[l,r]}$,其实就是${sum(x)-sum(y)}$,我们这…
Time Limit: 5000MS   Memory Limit: 131072K Total Submissions: 97008   Accepted: 30285 Case Time Limit: 2000MS Description You have N integers, A1, A2, ... , AN. You need to deal with two kinds of operations. One type of operation is to add some given…
poj3468 A Simple Problem with Integers 题意:O(-1) 思路:O(-1) 线段树功能:update:成段增减 query:区间求和 Sample Input 10 5 1 2 3 4 5 6 7 8 9 10 Q 4 4 Q 1 10 Q 2 4 C 3 6 3 Q 2 4 Sample Output 4 55 9 15 Hint The sums may exceed the range of 32-bit integers. 题目大意:   N个数 M…