高阶差分板子题

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. 使用Yii2中dropdownlist实现地区三级联动的例子

    原文:http://www.yiichina.com/code/636 <?php use yii\helpers\Url; use yii\widgets\ActiveForm; use yi ...

  2. SpringBoot使用SpringSecurity搭建基于非对称加密的JWT及前后端分离的搭建

    SpringBoot使用SpringSecurity搭建基于非对称加密的JWT及前后端分离的搭建 - lhc0512的博客 - CSDN博客 https://blog.csdn.net/lhc0512 ...

  3. 【python】Python3 循环语句

    [python]几种常见的循环 注意:如果涉及到程序中print语句中含有%d,%s,那么要在脚本最开始写语句:#coding=utf-8,才能够正常输出想要的数字或者字符串. Python3 循环语 ...

  4. java 字节流和字符流转换类InputStreamReader,OutPutStreamReader

    watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvY2pjMjExMzIy/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA ...

  5. Linux下Rsync+Inotify-tools实现数据实时同步

    Linux下Rsync+Inotify-tools实现数据实时同步 注意:下面的三个案例都是rsync 每次都是全量的同步(这就坑爹了),而且 file列表是循环形式触发rsync ,等于有10个文件 ...

  6. Openstack(四)Mysql主从

    4.1 安装mysql 4.1.1 安装依赖 # yum install vim gcc gcc-c++ wget autoconf  net-tools lrzsz iotop lsof iotop ...

  7. cocos代码研究(14)Widget子类Button学习笔记

    理论基础 表示一个按钮组件. 按钮可以被按下,或者点击, 并且在按下或者点击之后,可以由用户指定一个动作来执行,继承自 Widget. 代码部分 static Button * create ()创建 ...

  8. 20145301《网络对抗》Exp2 后门原理与实践

    20145301<网络对抗>Exp2 后门原理与实践 基础问题回答 例举你能想到的一个后门进入到你系统中的可能方式? 系统或者某些软件自身留下的后门. 钓鱼网站等非正规网站上捆绑下载 例举 ...

  9. 嵌入式 Linux 如何操作 GPIO ?

    作者:刘凯链接:https://www.zhihu.com/question/19704852/answer/19760467来源:知乎著作权归作者所有.商业转载请联系作者获得授权,非商业转载请注明出 ...

  10. ubuntu如何使zsh替换bash

    答:  1.安装zsh sudo apt-get install zsh 2.zsh替换bash sudo chsh -s `which zsh` 3.重启 (注:重启后打开一个终端会自动进入zsh的 ...