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 ...
随机推荐
- 使用任意的输入流(InputStream)实例,包括字符串形式的文件路径或者 file:// 的 URL 形式的文件路径来配置
mybatis – MyBatis 3 | 入门 http://www.mybatis.org/mybatis-3/zh/getting-started.html 从 XML 中构建 SqlSessi ...
- BBS - 文章详细页、点赞、踩灭
一.文章详细页 文章详细页:1.链接:<div><h5><a href="/blog/{{ article.user.username }}/articles/ ...
- Python开发【笔记】:接口
接口 什么是接口 ? 接口只是定义了一些方法,而没有去实现,多用于程序设计时,只是设计需要有什么样的功能,但是并没有实现任何功能,这些功能需要被另一个类(B)继承后,由 类B去实现其中的某个功能或全部 ...
- 001-Spring的设计理念和整体架构
一.概述 1.1.Spring的各个子项目 网站:https://spring.io/ 基于Spring的项目:https://spring.io/projects 文档列表:https://spri ...
- R语言基本语法
R语言基本语法 基本数据类型 数据类型 向量 vector 矩阵 matrix 数组 array 数据框 data frame 因子 factor 列表 list 向量 单个数值(标量)没有单独的数据 ...
- 本地blast的安装
1 下载程序 在ftp://ftp.ncbi.nlm.nih.gov/blast/executables/blast+/LATEST/下载 ncbi-blast-2.2.25+-x64-linux.t ...
- vue-router的hash模式与history模式的对比
Vue-router 中hash模式和history模式的关系在vue的路由配置中有mode选项 最直观的区别就是在url中 hash 带了一个很丑的 # 而history是没有#的mode:&quo ...
- 梅尔频率倒谱系数(MFCC) 学习笔记
最近学习音乐自动标注的过程中,看到了有关使用MFCC提取音频特征的内容,特地在网上找到资料,学习了一下相关内容.此笔记大部分内容摘自博文 http://blog.csdn.net/zouxy09/ar ...
- WinterCamp2017 游记
Winter is coming! Day0 Day0前一天打了一轮CF,做完了ABCD,Div2 Rank59.然后就去开开心心的睡觉,准备第二天的行程. 快到一点的时候躺在了床上,睡不着,翻来覆去 ...
- LINUX实践--程序破解
实验思想 本次实验的主要思想有两个,第一个是修改跳转指令,把它变成无条件跳转使得无论输入什么用户名都跳转到失败的那个选项中去,第二个思想是修改比对的内容,即不判断条件,从而成功 实验步骤 1.首先从老 ...