高阶差分板子题

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 (高阶差分)的更多相关文章

  1. Curious Array Codeforces - 407C(高阶差分(?)) || sequence

    https://codeforces.com/problemset/problem/407/C (自用,勿看) 手模一下找一找规律,可以发现,对于一个修改(l,r,k),相当于在[l,r]内各位分别加 ...

  2. codeforces 407C Curious Array

    codeforces 407C Curious Array UPD: 我觉得这个做法比较好理解啊 参考题解:https://www.cnblogs.com/ChopsticksAN/p/4908377 ...

  3. Codeforces 408 E. Curious Array

    $ >Codeforces \space 408 E. Curious Array<$ 题目大意 : 有一个长度为 \(n\) 的序列 \(a\) ,\(m\) 次操作,每一次操作给出 \ ...

  4. Greg and Array CodeForces 296C 差分数组

    Greg and Array CodeForces 296C 差分数组 题意 是说有n个数,m种操作,这m种操作就是让一段区间内的数增加或则减少,然后有k种控制,这k种控制是说让m种操作中的一段区域内 ...

  5. CodeForces 408E Curious Array(组合数学+差分)

    You've got an array consisting of n integers: a[1], a[2], ..., a[n]. Moreover, there are m queries, ...

  6. Imbalanced Array CodeForces - 817D (思维+单调栈)

    You are given an array a consisting of n elements. The imbalance value of some subsegment of this ar ...

  7. CodeForces 407C 组合数学(详解)

    题面: http://codeforces.com/problemset/problem/407/C 一句话题意:给一个长度为n的序列g,m次操作,每次操作(l,r,k)表示将g[l]~g[r]的每个 ...

  8. Petya and Array CodeForces - 1042D (树状数组)

    D. Petya and Array time limit per test 2 seconds memory limit per test 256 megabytes input standard ...

  9. AC日记——Little Elephant and Array codeforces 221d

    221D - Little Elephant and Array 思路: 莫队: 代码: #include <cmath> #include <cstdio> #include ...

随机推荐

  1. 170726、常用 Git 命令清单

    ,下面是我整理的常用 Git 命令清单.几个专用名词的译名如下: Workspace:工作区 Index / Stage:暂存区 Repository:仓库区(或本地仓库) Remote:远程仓库 一 ...

  2. jquery操作select标签change事件

    $('#update_supply_id').on('change',function(){//判断是否选取prompt属性,无返回值: if($(this).val()){ var selectTe ...

  3. 编译安装基于nginx与lua的高性能web平台-openresty

    1.首先编译安装nginx(不多说) 2.开始安装openresty cd /usr/local/src wget https://openresty.org/download/openresty-1 ...

  4. (转)大数据量下的SQL Server数据库优化

     在SQL Server中,默认MDF文件初始大小为5MB,自增为1MB,不限增长,LDF初始为1MB,增长为10%,限制文件增长到一定的数目:一般设计中,使用SQL自带的设计即可,但是大型数据库设计 ...

  5. linux dd命令详解及使用案例场景

    一.dd命令 dd:用指定大小的块拷贝一个文件,并在拷贝的同时进行指定的转换. 注意:指定数字的地方若以下列字符结尾,则乘以相应的数字:b=512:c=1:k=1024:w=2 参数注释: 1. if ...

  6. backend community-driven web framework

    kataras/iris: The fastest backend community-driven web framework on (THIS) Earth. HTTP/2, MVC and mo ...

  7. vue - webpack、babel

    一.webpack 在这里我仅仅的是对webpack做个讲解,webpack这个工具非常强大,解决了我们前端很繁琐的一些工具流程繁琐的事情.如果感兴趣的同学,建议还是看官网吧. 中文链接地址:http ...

  8. 监听checkbox事件

    <!DOCTYPE html> <html> <head> <title></title> </head> <script ...

  9. Python总结篇——知识大全

    python基础 Python开发环境搭建 Python变量和基本数据类型 python基本数据类型之操作 python的语法规范及for和while python编码 python文件操作 pyth ...

  10. 窗口-EasyUI Window 窗口、EasyUI Dialog 对话框、EasyUI Messager 消息框

    EasyUI Window 窗口 扩展自 $.fn.panel.defaults.通过 $.fn.window.defaults 重写默认的 defaults. 窗口(window)是一个浮动的.可拖 ...