Codeforces Round #240 (Div. 1) ABCD
来源:互联网 发布:三维直方图制作软件 编辑:程序博客网 时间:2024/06/05 15:41
转载请注明出处
题目链接
A:
把分数尽量放在第一对数对上,然后让剩下的数对两两互质即可,注意一些特殊情况(m=0或者n=1)
B:
dp[长度][当前最后一个数的大小],这样去转移:dp[len][x] = sigma(dp[len-1][y,y是x的因数]),因为每个数的约数都不多。
C:
建立归并树,求一下每一层新产生顺序对和逆序对
然后注意到,进行操作x时,只会影响归并树中第[x,n]层的逆序关系,那么就把对应层的逆序对和顺序对数量交换一下就好了,最后再O(n)统计一下当前的逆序对数,就是答案了
D:
容易知道答案只与树节点的层次分布有关,和树的形状无关,因此先预处理出dep[i]表示在dfs树中深度为i的节点有多少
然后这样得到答案:枚举每一层,考虑让最后这一层的水滴数最大,那么就是通过硬币让位于前面层的水滴延迟到这一层,代价为两层深度差,这里用线段树维护一下就好了
0 0
- Codeforces Round #240 (Div. 1) ABCD
- Codeforces Round #213 (Div. 1) ABCD
- Codeforces Round #219 (Div. 1) ABCD
- Codeforces Round #221 (Div. 1) ABCD
- Codeforces Round #223 (Div. 1) ABCD
- Codeforces Round #232 (Div. 1) ABCD
- Codeforces Round #240 (Div. 2) ABCD简单解题报告
- Codeforces Round #453 (Div. 1)解题报告(ABCD)
- Codeforces Beta Round #67 (Div. 2) ABCD
- Codeforces Round #191 (Div. 2) ABCD
- Codeforces Round #193 (Div. 2) ABCD
- Codeforces Round #211 (Div. 2) ABCD
- Codeforces Round #208 (Div. 2) ABCD
- Codeforces Round #220 (Div. 2) ABCD
- Codeforces Round #222 (Div. 2) ABCD
- Codeforces Round #257 (Div. 2) ABCD
- Codeforces Round #258 (Div. 2)[ABCD]
- Codeforces Round #264 (Div. 2) | ABCD
- 在创业型软件公司的收获
- codeforces 414b(数位DP)
- 清明节左作业
- 详细解析Java中抽象类和接口的区别
- mysql use
- Codeforces Round #240 (Div. 1) ABCD
- 进程间通信-信号(signal)
- fatal error LNK1123: failure during conversion to COFF
- DB优化简单总结
- Hibernate get和load区别
- 最近关注的几个算法
- 《Box2D for Flash Games》翻译 在世界里添加刚体(A)
- 面试-Synchronized和Lock的区别
- Linux 下的创建压缩文件与其对应的解压方式和tar 命令的使用