Codeforces Round #176 (Div. 1 + Div. 2)
A. IQ Test
- 模拟。
B. Pipeline
- 贪心。
C. Lucky Permutation
- 每4个数构成一个循环。
- 当n为偶数时,n=4k有解;当n为奇数时,n=4k+1有解。
D. Shifting
- 本质相当于每次把每段的首个数字移动到下段的首部。
E. Main Sequence
- 括号匹配。
D. Tourists
- 对于每个询问\(q\)来说,被墙的挡住的位置满足\(l_i\le x\le r_i,t_i\le q+x\),即\(max\{l_i,t_i-q\}\le x \le r_i\)。
- 当\(l_i\)为最大值时,\(l_i\ge t_i - q\),即\(q\ge t_i - li\),考虑到\(q\)是严格递增的,所以可以按照\(t_i-l_i\)对墙排序,小于等于\(q\)的贡献为\(r_i-l_i\)。这个贡献与\(q\)无关,所以直接求和即可。
- 当\(t_i-q\)为最大值时,这些墙体的贡献为\(\sum{r_i-(t_i-q)}=\sum{r_i-t_i}+kq\)。所以需要维护\(r_i-ti\)的值以及相应的墙的数量。
- 由于墙会出现重叠情况,所以需要按照时间顺序,将墙处理成不相交的状态。离散化的方法是:用\(set\)维护未被覆盖的小区间,均摊复杂度为\(logn\)。
E. Ladies' Shop
- 因为\(1\le a_i \le m\),所以\(p_j=a_i\),否则\(p_j\)无法用\(\sum{a_i}\)表示。
- 对于\(a_k\)来说,必然要存在\(a_k=a_i+a_j,k>i,j\),否则会不满足条件2,剩下的就是用fft判断\(a_k=a_i+a_j\)这个等式是否成立。
Codeforces Round #176 (Div. 1 + Div. 2)的更多相关文章
- Educational Codeforces Round 60 (Rated for Div. 2) - C. Magic Ship
Problem Educational Codeforces Round 60 (Rated for Div. 2) - C. Magic Ship Time Limit: 2000 mSec P ...
- Educational Codeforces Round 60 (Rated for Div. 2) - D. Magic Gems(动态规划+矩阵快速幂)
Problem Educational Codeforces Round 60 (Rated for Div. 2) - D. Magic Gems Time Limit: 3000 mSec P ...
- Educational Codeforces Round 43 (Rated for Div. 2)
Educational Codeforces Round 43 (Rated for Div. 2) https://codeforces.com/contest/976 A #include< ...
- Educational Codeforces Round 35 (Rated for Div. 2)
Educational Codeforces Round 35 (Rated for Div. 2) https://codeforces.com/contest/911 A 模拟 #include& ...
- Codeforces Educational Codeforces Round 44 (Rated for Div. 2) F. Isomorphic Strings
Codeforces Educational Codeforces Round 44 (Rated for Div. 2) F. Isomorphic Strings 题目连接: http://cod ...
- Codeforces Educational Codeforces Round 44 (Rated for Div. 2) E. Pencils and Boxes
Codeforces Educational Codeforces Round 44 (Rated for Div. 2) E. Pencils and Boxes 题目连接: http://code ...
- Educational Codeforces Round 63 (Rated for Div. 2) 题解
Educational Codeforces Round 63 (Rated for Div. 2)题解 题目链接 A. Reverse a Substring 给出一个字符串,现在可以对这个字符串进 ...
- Educational Codeforces Round 39 (Rated for Div. 2) G
Educational Codeforces Round 39 (Rated for Div. 2) G 题意: 给一个序列\(a_i(1 <= a_i <= 10^{9}),2 < ...
- Educational Codeforces Round 48 (Rated for Div. 2) CD题解
Educational Codeforces Round 48 (Rated for Div. 2) C. Vasya And The Mushrooms 题目链接:https://codeforce ...
- Educational Codeforces Round 60 (Rated for Div. 2) 题解
Educational Codeforces Round 60 (Rated for Div. 2) 题目链接:https://codeforces.com/contest/1117 A. Best ...
随机推荐
- Legal or Not HDU - 3342 (拓扑排序)
注意点: 输入数据中可能有重复,需要进行处理! #include <stdio.h> #include <iostream> #include <cstring> ...
- 使用Git Bash进行代码管理
前提是已经安装了GitBash,这个稍后再出教程 1.新建一个目录,存放下载下来的项目,我在D盘新建了一个“gitspace”文件夹,用来存放下载下来的项目 2.进入刚刚新建的文件夹,即进入“gits ...
- Vue. 之 npm安装Element
Vue. 之 npm安装Element 前提: 相关运行环境以搭建完成,例如:Node.Npm等. 假如我的项目目录如下: D:\DISK WORKSPACE\VSCODE\CDS\cds-ap ...
- python pattern 类
- Leetcode876.Middle of the Linked List链表的中间节点
给定一个带有头结点 head 的非空单链表,返回链表的中间结点. 如果有两个中间结点,则返回第二个中间结点. 示例 1: 输入:[1,2,3,4,5] 输出:此列表中的结点 3 (序列化形式:[3,4 ...
- Web.xml详解(转)(Filter,context,listener)
web.xml 详细解释!!(链接) web.xml加载过程(步骤) 首先简单说一下,web.xml的加载过程. 当我们去启动一个WEB项目时,容器包括(JBoss.Tomcat等)首先会读取项目we ...
- 在Eclipse中添加Tomcat
在Eclipse中开发web或开启web服务需要Tomcat的支持,在添加Tomcat之前要清楚你的Eclipse版本,如果你的Eclipse是javvEE版的就可以直接安装Tomcat,如果不是就需 ...
- 【JZOJ4924】【NOIP2017提高组模拟12.17】向再见说再见
题目描述 数据范围 =w= 设h[i]表示,甲队得到i分的方案数. 那么h[(n+k)/2]和h[(n−k)/2]就是答案. 设g[i]表示,甲队得到至少i分的方案数. 那么h[i]=g[i]−∑j& ...
- 【JZOJ4910】【NOIP2017模拟12.3】子串
题目描述 数据范围 =w= 暴力: 从前往后枚举一个i,再从前往后枚举一个j: 如果s[i]不是s[j]的子串,更新答案,继续枚举: 如果s[i]是s[j]的子串,停止枚举. 因为对于s[k] (k& ...
- sql —— check
CHECK 约束用于限制列中的值的范围. 原表: 现在要对性别这一列进行约束,只准值为男或者女. 步骤: 1. 2. 3. 4. 5. ctrl + s 保存一下, 现在不可以随意的修改性别了. 完成 ...