D. Guess Your Way Out! II Problem's Link: http://codeforces.com/problemset/problem/558/D Mean: 一棵满二叉树,树中某个叶子节点是出口,目的是寻找这个出口.再给定Q个询问的结果,每个结果告诉我们在第i层中(l,r)覆盖的叶结点是否包含出口. analyse: 基本思路:多个区间求交集. 具体实现: 对于每一个询问,把它转化到最底层.并且把不在(l,r)区间的询问改为在(最左边,l-1)和(r+1,最右边)…
D. Guess Your Way Out! II time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Amr bought a new video game "Guess Your Way Out! II". The goal of the game is to find an exit from the maze t…
题目链接 题意: 给出n和q 表示有一棵深度为n的全然二叉树.叶子节点中有恰好一个点是出口 主角从根往下走.但不知道出口在哪里,但主角会获得q个提示.  像这样标号 q个提示 格式: deep [l, r] ok  表示 深度为deep 时, 出口(可能在) (一定不在)[l,r]区间  ok=1表示 是可能在 ok=0一定不在 目标: 若依据提示能找到出口则输出叶子节点下标,有多个可能的出口则输出data not sufficient.若给出的提示互相矛盾输出 Game cheatde 思路:…
LINK:Kaavi and Magic Spell 一打CF才知道自己原来这么菜 这题完全没想到. 可以发现 如果dp f[i][j]表示前i个字符匹配T的前j个字符的方案数 此时转移变得异常麻烦 状态转移一次变成了O(n). 会超时 而且这个状态的转移也是不正确的 可能当前的S字符串后面放了一些不能匹配的东西 但是此时却体现不出来. 那我们如何描述每次增加一个字符且和T匹配多少这种状态呢. 一个思路 先对于S串的某个i暴力枚举 其对应在T中的位置 这样的话dp就变成了 f[i][j][k]表…
题目大意:对下列代码进行优化 long long H( int n ) {    long long res = 0;    for( int i = 1; i <= n; i++ )        res = res + n / i;    return res;} 题目思路:为了避免超时,要想办法进行优化 以9为例: 9/1 = 9 9/2 = 4 9/3 = 3 9/4 = 2 9/5 = 1 9/6 = 1 9/7 = 1 9/8 = 1 9/9 = 1 拿1来看,同为1的区间长度为:9…
I: Given an array of non-negative integers, you are initially positioned at the first index of the array. Each element in the array represents your maximum jump length at that position. Determine if you are able to reach the last index. For example:A…
http://www.lightoj.com/volume_showproblem.php?problem=1089 题意:给出许多区间,查询某个点所在的区间个数 思路:线段树,由于给出的是区间,查询的是点,考虑将其离线并离散化,普通线段树即可. /** @Date : 2016-12-17-20.49 * @Author : Lweleth (SoungEarlf@gmail.com) * @Link : https://github.com/ * @Version : */ #include…
http://acm.fzu.edu.cn/problem.php?pid=2171 成段增减,区间求和.add累加更新的次数. #include <iostream> #include <cstdio> #include <cmath> #include <vector> #include <cstring> #include <string> #include <algorithm> #include <stri…
知识太全面了,摘抄摘不完,还是粘过来加上注释和笔记吧. 重点以及断句用加粗,注释用红括号. 一.CF卡技术及规格 一.CF卡技术及规格 1.CF卡简史 随着数码产品的高速普及,近年来闪存卡也进入了高速发展时期,得到了越来越广泛的应用,相机.手机.掌上电脑.随身听上处处都可能用到闪存卡.闪存卡有很多种类,常见的有CF卡.SD卡.MMC卡.记忆棒.SM卡.xD卡等,其中CF卡已经有了相当长的历史,由于其建立标准的时间长.兼容性好.容量大.价格低等原因而得到了广泛的应用,是通用性 最强的存储卡之一.…
[链接]:CF/4892 [题意]: 一个人解决n个问题,这个问题的值比k小, 每次只能解决最左边的或者最右边的问题 解决了就消失了.问这个人能解决多少个问题. [代码]: #include<bits/stdc++.h> #define PI acos(-1.0) #define pb push_back #define F first #define S second #define debug puts #define setp cout << fixed << s…