Codeforces Round #112 (Div. 2)
Codeforces Round #112 (Div. 2)
C. Another Problem on Strings
题意
- 给一个01字符串,求包含\(k\)个1的子串个数。
思路
- 统计字符1的位置,两端用0填充。
- \(k=0\)需要特判。
代码
D. Beard Graph
题意
- 一棵\(N(N \le 10^5)\)个点的树,每条边被染成黑色或白色,初始都是黑色。
- \(M(M \le 3 \times 10^5)\)次操作,要么对边染色,要么询问\((a, b)\)路径上的边是否都是黑色,如果是的话求出两点距离。
思路
- 裸树链剖分
代码
E. Compatible Numbers
题意
- 给\(N(N \le 10^6)\)个数\(a_i(1 \le a_i \le 10^{22})\)
- 对于每个\(a_i\),找到任意一个\(a_j\),使得\(a_i\ and \ a_j\ =\ 0\),不存在则输出-1。
思路
- 相当于在\(a_i\)补集中找原数组的数
- 用\(dp[mask]\)表示\(a_i\)是\(mask\)子集的一个数,那么\(O(22 \times 2^{22})\)转移一下即可。
代码
Codeforces Round #112 (Div. 2)的更多相关文章
- Codeforces Round #112 (Div. 2) D. Beard Graph
地址:http://codeforces.com/problemset/problem/165/D 题目: D. Beard Graph time limit per test 4 seconds m ...
- Codeforces Round #112 (Div. 2)---A. Supercentral Point
Supercentral Point time limit per test 2 seconds memory limit per test 256 megabytes input standard ...
- Codeforces Round #633 (Div. 2)
Codeforces Round #633(Div.2) \(A.Filling\ Diamonds\) 答案就是构成的六边形数量+1 //#pragma GCC optimize("O3& ...
- Codeforces Round #366 (Div. 2) ABC
Codeforces Round #366 (Div. 2) A I hate that I love that I hate it水题 #I hate that I love that I hate ...
- Codeforces Round #354 (Div. 2) ABCD
Codeforces Round #354 (Div. 2) Problems # Name A Nicholas and Permutation standard input/out ...
- Codeforces Round #368 (Div. 2)
直达–>Codeforces Round #368 (Div. 2) A Brain’s Photos 给你一个NxM的矩阵,一个字母代表一种颜色,如果有”C”,”M”,”Y”三种中任意一种就输 ...
- cf之路,1,Codeforces Round #345 (Div. 2)
cf之路,1,Codeforces Round #345 (Div. 2) ps:昨天第一次参加cf比赛,比赛之前为了熟悉下cf比赛题目的难度.所以做了round#345连试试水的深浅..... ...
- Codeforces Round #279 (Div. 2) ABCDE
Codeforces Round #279 (Div. 2) 做得我都变绿了! Problems # Name A Team Olympiad standard input/outpu ...
- Codeforces Round #262 (Div. 2) 1003
Codeforces Round #262 (Div. 2) 1003 C. Present time limit per test 2 seconds memory limit per test 2 ...
随机推荐
- 2、IValueConverter应用
1.C#代码如下: public class logotoimgConverter:IValueConverter { //将logo转换为URI public object Convert(obje ...
- Cisco IOS basic system management command reference
absolute : to specify an absolute time for a time-range (in time-range configuration mode) no absolu ...
- APC to USB
from :http://www.allpinouts.org/index.php/APC_USB_cable_schematic connector or cable wiring APC part ...
- 添加Sql作业,新建步骤出现:从IClassFactory为CLSID为{AA40D1D6-CAEF-4A56-B9BB-D0D3DC976BA2}的COM组件创建实例失败,原因是出现以下错误:c001f011。的解决方法
32位操作系统: 打开运行(命令提示符), 一.输入 cd c:\windows\system32 进入到c:\windows\system32路径中 二.输入 regsvr32 "C:\P ...
- EF学习笔记(一)
EF(EntityFramwork)实体框架:主要是将实体类(EntityClass)和数据表(Table)进行映射(Map). EF核心对象: DbContext (数据访问核心对象) ...
- Tarjan算法求有向图的强连通分量
算法描述 tarjan算法思想:从一个点开始,进行深度优先遍历,同时记录到达该点的时间(dfn记录到达i点的时间),和该点能直接或间接到达的点中的最早的时间(low[i]记录这个值,其中low的初始值 ...
- hdu 2044
ps:好吧,WA了两次,第一次注意到要用long long了...但是printf那里给忘了...又WA.. 代码:#include "stdio.h"long long dp[5 ...
- ubuntu知识收集
1 就像windows下的环境变量分为系统变量和用户变量一样,ubuntu下也是一样,四种环境变量, 1 系统环境变量:/etc/enviroment, 是整个系统的环境变量,与登录用户无关,在这 ...
- 使用树莓派和kali Linux打造便携式渗透套件
在DIY前你需要: .树莓派Raspberry Pi Model B+型 或者 树莓派2代; .充电宝 X1; .USB WIFI网卡 X1; .8G SD卡 X1; .Raspberry PI触摸显 ...
- Python ~~~ 面向对象的利器
class Rectangle(): # 有没有括号都行 . def __init__(self,x,y): self.x=x self.y=y def getPeri(self): def getA ...