Curious Array CodeForces - 407C (高阶差分)
高阶差分板子题
const int N = 1e5+111;
int a[N], n, m, k; int C[N][111], d[N][111]; signed main() {
scanf("%d%d", &n, &m);
REP(i,1,n) scanf("%d", a+i);
REP(i,0,n+100) {
C[i][0]=1;
REP(j,1,100) C[i][j]=(C[i-1][j]+C[i-1][j-1])%P;
}
REP(i,1,m) {
int l, r, k;
scanf("%d%d%d", &l, &r, &k);
int mx = min(r-l,k);
REP(j,0,mx) (d[l+j][j]+=C[k][k-j])%=P;
REP(j,0,mx) (d[r+1][j]+=(P-C[r-l-j+k][k-j])%P)%=P;
}
PER(j,0,100) REP(i,1,n) {
(d[i][j]+=(d[i][j+1]+d[i-1][j])%P)%=P;
}
REP(i,1,n) printf("%d ",(d[i][0]+a[i])%P);hr;
}
Curious Array CodeForces - 407C (高阶差分)的更多相关文章
- Curious Array Codeforces - 407C(高阶差分(?)) || sequence
https://codeforces.com/problemset/problem/407/C (自用,勿看) 手模一下找一找规律,可以发现,对于一个修改(l,r,k),相当于在[l,r]内各位分别加 ...
- codeforces 407C Curious Array
codeforces 407C Curious Array UPD: 我觉得这个做法比较好理解啊 参考题解:https://www.cnblogs.com/ChopsticksAN/p/4908377 ...
- Codeforces 408 E. Curious Array
$ >Codeforces \space 408 E. Curious Array<$ 题目大意 : 有一个长度为 \(n\) 的序列 \(a\) ,\(m\) 次操作,每一次操作给出 \ ...
- Greg and Array CodeForces 296C 差分数组
Greg and Array CodeForces 296C 差分数组 题意 是说有n个数,m种操作,这m种操作就是让一段区间内的数增加或则减少,然后有k种控制,这k种控制是说让m种操作中的一段区域内 ...
- CodeForces 408E Curious Array(组合数学+差分)
You've got an array consisting of n integers: a[1], a[2], ..., a[n]. Moreover, there are m queries, ...
- Imbalanced Array CodeForces - 817D (思维+单调栈)
You are given an array a consisting of n elements. The imbalance value of some subsegment of this ar ...
- CodeForces 407C 组合数学(详解)
题面: http://codeforces.com/problemset/problem/407/C 一句话题意:给一个长度为n的序列g,m次操作,每次操作(l,r,k)表示将g[l]~g[r]的每个 ...
- Petya and Array CodeForces - 1042D (树状数组)
D. Petya and Array time limit per test 2 seconds memory limit per test 256 megabytes input standard ...
- AC日记——Little Elephant and Array codeforces 221d
221D - Little Elephant and Array 思路: 莫队: 代码: #include <cmath> #include <cstdio> #include ...
随机推荐
- MySQL数据的查询注意
mysql数据库的查询结果输出的是一个记录,这一个记录是以字典的形式存储的,所以获取字段时要用字典提取数据的形式获取字段信息: 查询的代码: def query(self): # sql语句 sql ...
- 人工智能(Machine Learning)—— 机器学习
https://blog.csdn.net/luyao_cxy/article/details/82383091 转载:https://blog.csdn.net/qq_27297393/articl ...
- 关于volatile 最完整的一篇文章
你真的了解volatile关键字吗? 一.Java内存模型 想要理解volatile为什么能确保可见性,就要先理解Java中的内存模型是什么样的. Java内存模型规定了所有的变量都存储在主内存中.每 ...
- Java中参数传递时值传递的机制分析
参数传递是什么? 在C的函数或是JAVA的方法中,向一个函数或方法内部传递一个参数,比如: void fun( int num ){ num+=2 ; } int a = 3 ...
- win安装mysql
在这讲解的是有关于通过zip解压安装MySQL的方法.有看了网上的其它的教程,讲的有些不够完善,也自己写一篇简述一下.个人还是建议看官方的参考文档非常之详细:https://dev.mysql.com ...
- SVN提交修改时出现:Checksum mismatch
在使用SVN commit提交修改时,提示Checksum mismatch 问题,提示版本不一致,不能提交,类似于下图. 图片来源于网络,如有侵权,请告知删除. 搜索stackoverflow.co ...
- 3vim编辑器
三种模式命令行模式任何模式下 ESC 进入编辑模式(INSERT)从命令模式下 a, i 等 进入可视化模式(VISUAL)(VISUAL BLOCK)命令模式下,敲 v 进入非编辑模式, ctrl ...
- 牛客国庆集训派对Day1 Solution
A Tobaku Mokushiroku Kaiji 水. #include <bits/stdc++.h> using namespace std; ], b[]; void Ru ...
- 字王·国标二级字库汉字GB内码un码三合一对照表2016版
国标二级字库汉字GB内码un码三合一对照表 字王2016版 汉字内码表,是制作字库的基础,简单.便利的版本很少,根据实战经验,特此制作这个三合一版本的汉字.GB内码.Unicode码对照表: l 提供 ...
- Flask 使用富文本输入框
模板 <script src="{{ url_for('static', filename='ckeditor/ckeditor.js') }}"></scrip ...