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 ...
随机推荐
- IT公司100题-14-排序数组中和为给定值的两个数字
问题描述: 输入一个升序排序的数组,给定一个目标值target,求数组的两个数a和b,a+b=target.如果有多个组合满足这个条件,输出任意一对即可. 例如,输入升序数组[1, 3, 4, 5, ...
- IT公司100题-5-查找最小的k个元素
问题描述: 输入n 个整数,输出其中最小的k 个. 例如输入8, 7, 6, 5, 4, 3, 2, 1这8 个数字,则最小的3 个数字为3, 2, 1. 分析: 时间复杂度O(nlogn)方法: ...
- MapReduce基础
这篇文章翻译自Yahoo的Hadoop教程,很久之前就看过了,感觉还不错.最近想总结一下以前学的东西,看到现在关于Hadoop的中文资料还比较少,就有了把它翻译出来的想法,希望能帮助到初学者.这只是Y ...
- 常错-UIScrollView中得图片不能被拖动
经常在开发中,发现自己UIScrollView里面的图片不能被拖动 在这里做个备忘,第一种可能是contentSize没有设置,第二种可能是contentSize设置的太小了. 测试后发现,与user ...
- SharePoint 2016 的新特性概览(一)(What's New for IT Professionals in SharePoint Server 2016)
博客地址:http://blog.csdn.net/FoxDave 今天看霖雨大神的转的微软最新的关于SharePoint 2016的Update,正好看到了SP2016新发布的视频,整理一下发出 ...
- 命令行BASH
shell 壳,把用户的指令翻译给内核kernel,真正工作的是内核 shell分为cli(command line interface)和gui(graphical user interface) ...
- 《c语言全局变量的用法》
//全局变量的用法. /*有一个一维数组,内放n个学生的成绩,(n由用户自己指定,通过调用函数实现定义一个数组.)写一个函数,当主函数调用此函数后,能求出平均分,最高分,最低分.*/ #include ...
- Cocoa Drawing
Graphics Contexts Graphics contexts are a fundamental part of the drawing infrastructure in Cocoa ap ...
- (转)Document对象内容集合
原文:http://webcenter.hit.edu.cn/articles/2009/06-10/06144703.htm document 文挡对象 - JavaScript脚本语言描述 ——— ...
- 【LeetCode OJ】Palindrome Partitioning
Problem Link: http://oj.leetcode.com/problems/palindrome-partitioning/ We solve this problem using D ...