<?xml version="1.0" encoding="utf-8" ?><rss version="2.0"><channel><title><![CDATA[C_z_Q]]></title><description><![CDATA[ACM Retired]]></description><link>https://blog.csdn.net/Chyllo</link><language>zh-cn</language><generator>https://blog.csdn.net/</generator><copyright><![CDATA[Copyright &copy; Chyllo]]></copyright><item><title><![CDATA[PAT 甲级 1016 Phone Bills.[模拟排序]]]></title><link>https://blog.csdn.net/Chyllo/article/details/80466113</link><guid>https://blog.csdn.net/Chyllo/article/details/80466113</guid><author>Chyllo</author><pubDate>Sat, 26 May 2018 23:26:56 +0800</pubDate><description><![CDATA[题意:  
1.先给了 242424 个数表示 242424 小时每个小时内通话的费用, 单位为 美分/分钟 
2.给了 N(≤1000)N(≤1000)N(\leq 1000) 条记录，记录格式为 [姓名][月:日:小时:分钟][on/off-line], 表示这个人在这个时间开始/结束通话。对于同一个人，每个开始通话记录与在它之后时间最近的结束通话记录相匹配，结束通话记录同理，一对匹配构成一次...]]></description><category></category></item><item><title><![CDATA[Gym 100825 G - Tray Bien[状压dp]]]></title><link>https://blog.csdn.net/Chyllo/article/details/78279046</link><guid>https://blog.csdn.net/Chyllo/article/details/78279046</guid><author>Chyllo</author><pubDate>Wed, 18 Oct 2017 23:00:24 +0800</pubDate><description><![CDATA[题意: 给定一个 3∗m3 * m的矩形，现在你有两种砖块1∗1,1∗21*1,1*2，有一些位置是不能放的，问有多少种放法使除了不能放的位置外全部放满。分析 : 很经典的状压dp，只是加了一些不能放的位置，题目输入使浮点数，我们直接取整表示这个格子不能放。然后就是一些状态的转移。以下是代码：#include<bits/stdc++.h>
using namespace std;
#define u]]></description><category></category></item><item><title><![CDATA[Gym 100825 H - Trick Shot[计算几何]]]></title><link>https://blog.csdn.net/Chyllo/article/details/78278934</link><guid>https://blog.csdn.net/Chyllo/article/details/78278934</guid><author>Chyllo</author><pubDate>Wed, 18 Oct 2017 22:49:09 +0800</pubDate><description><![CDATA[题意：给了一场长www，宽lll的台球桌，以桌子左下为原点,给了1,2,31,2,31,2,3三个球的坐标，给定了球的半径rrr和白球的纵坐标, 问是否可能白球撞到111号球，111号球撞向333号球使其进入右上角。白球撞到111号球后撞向222号球使其进入左上角,如果可能，输出白球的起始横坐标和发射方向与x轴正轴的夹角度数。分析：我们反过来推，通过右上角的点P(w,l)P(w,l)P(w,l) 和]]></description><category></category></item><item><title><![CDATA[Gym 101161 G - Binary Strings[矩阵快速幂][dp]]]></title><link>https://blog.csdn.net/Chyllo/article/details/78208320</link><guid>https://blog.csdn.net/Chyllo/article/details/78208320</guid><author>Chyllo</author><pubDate>Wed, 11 Oct 2017 21:00:53 +0800</pubDate><description><![CDATA[题意：问长度在 [L,R][L,R] 之间的，且长度被 KK整除的，且仅包含 00 和 11 的，且不包含连续 11 的字符串的个数。其中 1≤L,R≤1018,3≤K≤1091 \leq L,R \leq 10^{18}, 3 \leq K \leq 10^9 
分析：考虑dpdp，dp[i][0/1]dp[i][0/1]表示长度为 ii ，最后一位字符是 0,10,1的字符串个数。 
转移：dp]]></description><category></category></item><item><title><![CDATA[Gym 101161 E - ACM Tax[主席树][lca]]]></title><link>https://blog.csdn.net/Chyllo/article/details/78207997</link><guid>https://blog.csdn.net/Chyllo/article/details/78207997</guid><author>Chyllo</author><pubDate>Wed, 11 Oct 2017 20:30:57 +0800</pubDate><description><![CDATA[题意 : 给定一颗 NN 个点的树，每条边都有一个边权 ww ，然后是 QQ 个询问，每个询问包含 一组 (Ai,Bi)(A_i,B_i) ,问点AiA_i到点BiB_i的所有边权的中位数。 
其中 2≤N≤5∗104,1≤Q≤1052 \leq N \leq 5*10^4, 1 \leq Q \leq 10^5  
分析：求中位数就相当于求区间第KK大。考虑主席树，每个节点根据他的父节点的信息建树]]></description><category></category></item><item><title><![CDATA[HDU 6005 Pandaland[最小生成树][LCA]]]></title><link>https://blog.csdn.net/Chyllo/article/details/78166694</link><guid>https://blog.csdn.net/Chyllo/article/details/78166694</guid><author>Chyllo</author><pubDate>Fri, 06 Oct 2017 19:51:41 +0800</pubDate><description><![CDATA[题意：给定 MMM 条边，找一个路径最短的环，如果不存在环，输出 000。(1≤M≤4000)(1≤M≤4000)(1 \leq M \leq 4000)分析：通过观察可以发现，最短的环一定是在这个图的最小生成树上。 
这样，我们可以通过枚举不在树上的边，求树上这条边的两点间距离，加上边的权值并取个最小值即可。 
需要注意的是，题目给你的图可能有多个联通块。以下是代码。
#include<bits/]]></description><category></category></item><item><title><![CDATA[Gym 101243 I Land Division[计算几何]]]></title><link>https://blog.csdn.net/Chyllo/article/details/78159866</link><guid>https://blog.csdn.net/Chyllo/article/details/78159866</guid><author>Chyllo</author><pubDate>Wed, 04 Oct 2017 23:08:22 +0800</pubDate><description><![CDATA[题意：顺时针顺序给定一个NN个点的凸多边形,问是否能用一条线段将其分成一个MM边形和一个KK边形，如果能输出最短线段的长度，如果不能，输出−1-1。其中3≤N,M,K≤1003\leq N,M,K \leq 100。分析：通过观察我们可以发现，存在解的情况只有三种 :  
1.N+2=M+K。1.N+2 = M+K。 
2.N+3=M+K。2.N+3 = M+K。 
3.N+4=M+K。3.N+4=]]></description><category></category></item><item><title><![CDATA[Gym 101484 F No Link, Cut Tree![完全二叉树][st]]]></title><link>https://blog.csdn.net/Chyllo/article/details/78154683</link><guid>https://blog.csdn.net/Chyllo/article/details/78154683</guid><author>Chyllo</author><pubDate>Tue, 03 Oct 2017 14:28:19 +0800</pubDate><description><![CDATA[题意： 题目给了一个nn个点的完全二叉树，每个节点都有他的价值ww 
定义这棵树的价值为：每一个深度的价值为这个深度所有节点的价值总和，树的价值为 所有深度中价值最大的。 
然后有mm个询问，每个询问是一个节点uu 问删去以他为根的子树后，树的价值为多少。 
数据范围：1≤n≤1e5,1≤m≤1e5,1≤w≤1e41\leq n \leq 1e5,1\leq m \leq 1e5,1 \leq w]]></description><category></category></item><item><title><![CDATA[Gym 101484 I Matrix Sum]]></title><link>https://blog.csdn.net/Chyllo/article/details/78154370</link><guid>https://blog.csdn.net/Chyllo/article/details/78154370</guid><author>Chyllo</author><pubDate>Tue, 03 Oct 2017 12:37:00 +0800</pubDate><description><![CDATA[题意：题目给了一个矩阵 AAA 的定义： 
Aij=∑Nk=1(Mik+Mkj)−MijAij=∑k=1N(Mik+Mkj)−MijA_{ij}= \sum_{k = 1}^{N}(M_{ik} + M_{kj}) - M_{ij} 
其中 MMM 是一个仅由 0 和 1 组成的矩阵 
问，给定一个 n∗n(1≤n≤1e3)n∗n(1≤n≤1e3)n*n (1 \leq n \leq 1e3) 的]]></description><category></category></item><item><title><![CDATA[Codeforces 827A/828C String Reconstruction[线段树单点更新]]]></title><link>https://blog.csdn.net/Chyllo/article/details/75021477</link><guid>https://blog.csdn.net/Chyllo/article/details/75021477</guid><author>Chyllo</author><pubDate>Wed, 12 Jul 2017 16:03:22 +0800</pubDate><description><![CDATA[题意：给了你n个字符串,然后说明这个字符串在什么位置出现了，然后让你输出字典序最小的答案.


分析:
1.首先是答案的长度，因为长度约小字典序越小。所以长度取，给定的n个字符串出现的最大的(位置+len(i)-1);
2.如何把给定的字符串更新上去， 因为题目保证没有矛盾，所以更新过的点就不用再更新了，这样我们用一个vis数组，表示当前区间是否已经完全更新完，如果更新完了就不管了，没更]]></description><category></category></item><item><title><![CDATA[Codeforces 827C/828E DNA Evolution[树状数组]]]></title><link>https://blog.csdn.net/Chyllo/article/details/75020282</link><guid>https://blog.csdn.net/Chyllo/article/details/75020282</guid><author>Chyllo</author><pubDate>Wed, 12 Jul 2017 15:56:03 +0800</pubDate><description><![CDATA[题意：给定一个只包含A,T,C,G的字符串,有如下两种操作
1）修改一个点的字母
2）给定一个字符串e (strlen(e) 


思路: 对每个字母建立10 * 10个树状数组（前面的10表示e的长度，后面表示mod e的长度后的值），表示区间中膜len(e) 结果为 k = (0...len(e)-1)的个数。
查询的话，对于给定的e 查询对应len(e)的树状数组
比如给定 e]]></description><category></category></item><item><title><![CDATA[Codeforces 812C Sagheer and Nubian Market[二分]]]></title><link>https://blog.csdn.net/Chyllo/article/details/72843337</link><guid>https://blog.csdn.net/Chyllo/article/details/72843337</guid><author>Chyllo</author><pubDate>Fri, 02 Jun 2017 13:06:46 +0800</pubDate><description><![CDATA[题意：给了n个物品，每个物品的价值为ai，你可以选取其中的k个，代价是k个ai的和加上他们的下标乘k的和。
问，在给定最大代价S的条件下，最多能取几个，取的最多的情况下，代价是多少。


分析：对能取几个进行二分，每次判断的时候，将原来的数组对ai+i*mid排序，取前mid个，看是否大于S。


以下是代码：
ll n, s, ans1, ans2;
struct lx {
	l]]></description><category></category></item><item><title><![CDATA[Codeforces 812B Sagheer, the Hausmeister[dp]]]></title><link>https://blog.csdn.net/Chyllo/article/details/72843281</link><guid>https://blog.csdn.net/Chyllo/article/details/72843281</guid><author>Chyllo</author><pubDate>Fri, 02 Jun 2017 12:58:49 +0800</pubDate><description><![CDATA[题意：n层楼，每层楼有m个房间，m个房间的左右两边分别是楼梯。每个房间0表示灯关着，1表示灯开着，走一格需要一分钟，问最少需要几分钟把所有的灯都关了。
分析：我们先预处理出每层楼最左边的灯在什么位置，最右边的灯在什么位置，然后dp
dp[i][0]表示走到第i层的左边楼梯处，且i层以下的等全灭的最少时间，dp[i][1]则是走到第i层右边楼梯处的答案。
我们找出等未关的最高的楼层，再上面还有]]></description><category></category></item><item><title><![CDATA[Codeforces 812A Sagheer and Crossroads[模拟]]]></title><link>https://blog.csdn.net/Chyllo/article/details/72843264</link><guid>https://blog.csdn.net/Chyllo/article/details/72843264</guid><author>Chyllo</author><pubDate>Fri, 02 Jun 2017 12:47:10 +0800</pubDate><description><![CDATA[题意：（这题关键就是理解题意了。。） 
1. p[i]为1的时候，如果当前方向也有1，是会发生事故的，
2. p[i]为1的时候，其他方向开向 i 的路上也有1，也会发生事故。


以下是代码：
int l[5], s[5], r[5], p[5];
int main() {
	for (int i = 1; i <= 4; ++i) {
		scanf("%d%d%d%d", &l[]]></description><category></category></item><item><title><![CDATA[Codeforces 811E Vladik and Entertaining Flags[线段树][并查集]]]></title><link>https://blog.csdn.net/Chyllo/article/details/72828898</link><guid>https://blog.csdn.net/Chyllo/article/details/72828898</guid><author>Chyllo</author><pubDate>Thu, 01 Jun 2017 10:37:43 +0800</pubDate><description><![CDATA[题意：给了一个n*m的矩阵，上下左右相同数的点可以并为同一个联通块，对于每个询问L，R 输出(1,L) ... (n,R)的块中有几个联通块。


分析：用线段树维护每列的状况，一个sum表示这一块的联通块个数，L[i],R[i]表示这块中第i行左边的标号，右边的标号，标号用来表示属于哪一个联通块。
每次合并,先是sum相加，一行行判断是否能合并成一个联通块，如果左右数值相同，而且，左右标]]></description><category></category></item><item><title><![CDATA[Codeforces 811D Vladik and Favorite Game[模拟][bfs]]]></title><link>https://blog.csdn.net/Chyllo/article/details/72828769</link><guid>https://blog.csdn.net/Chyllo/article/details/72828769</guid><author>Chyllo</author><pubDate>Thu, 01 Jun 2017 10:26:18 +0800</pubDate><description><![CDATA[题意：说有四个按钮 L,R可能是反的，U,D可能是反的，然后对于你每次输出的(L,R,U,D)，会返回一个坐标，到达给定的F 的位置停止。


分析：关键就是判断L，R 是否是反的，U,D 是否是反的，刚开始的位置是(1,1)，贴墙的，为了防止走到 * 上，我们可以找一个右边是空的位置，然后输出一个L，如果在原地，那么说明 不反，如果到了右边，说明反了，对于U，D 也同样，知道反没反之后就是]]></description><category></category></item><item><title><![CDATA[Codeforces 811C Vladik and Memorable Trip[dp]]]></title><link>https://blog.csdn.net/Chyllo/article/details/72828666</link><guid>https://blog.csdn.net/Chyllo/article/details/72828666</guid><author>Chyllo</author><pubDate>Thu, 01 Jun 2017 10:18:49 +0800</pubDate><description><![CDATA[题意：给了一串长度


分析：我们可以先预处理出每个数第一次出现的位置st，最后出现的位置ed，还有区间的异或值sum
dp[i] 表示到了 i 之前的序列的答案为多少。
每次在ed的位置转移，判断其中是否有数的ed比现在大，如果大，跳过。没有的话，找其中最小的min_st，
dp[i] = min(dp[i-1],dp[min_st - 1] + sum[min_st][i]);
]]></description><category></category></item><item><title><![CDATA[Codeforces 811B Vladik and Complicated Book[主席树]]]></title><link>https://blog.csdn.net/Chyllo/article/details/72828597</link><guid>https://blog.csdn.net/Chyllo/article/details/72828597</guid><author>Chyllo</author><pubDate>Thu, 01 Jun 2017 10:11:11 +0800</pubDate><description><![CDATA[题意：给了一串长度为n的序列，每个数都不相同，随后是m个询问，L R K 问将[L,R]中的数从小到大排序后，原来第K个数是否还是第K个。


分析：用主席树维护这个序列，对于每个询问，查询这个区间里比a[K]大的数的个数Q，如果R - Q == k 输出 Yes。具体见代码。


以下是代码。
struct {
	int lc, rc, sum;
}st[MAXN * 40];
i]]></description><category></category></item><item><title><![CDATA[Codeforces 808G Anthem of Berland[dp][kmp]]]></title><link>https://blog.csdn.net/Chyllo/article/details/72730941</link><guid>https://blog.csdn.net/Chyllo/article/details/72730941</guid><author>Chyllo</author><pubDate>Thu, 25 May 2017 17:41:54 +0800</pubDate><description><![CDATA[题意：给定一个包含？的字符串A，还有一个字符串B，问B最多可能在A中出现几次。


分析：dp  
dp[i] 表示0-i的字符串最多能出现几次B
cnt[i] 表示最后一次出现的 B 以 i 结尾 0-i中最多能出现几次B
转移：为了转移，我们还需要一个next数组
首先将dp[i] 赋值为 dp[i - 1],
O(lenB)判断是否能以当前位置结尾，（如果有一个位置字符不相同]]></description><category></category></item><item><title><![CDATA[HDU 6031 Innumerable Ancestors[树链剖分]]]></title><link>https://blog.csdn.net/Chyllo/article/details/71403549</link><guid>https://blog.csdn.net/Chyllo/article/details/71403549</guid><author>Chyllo</author><pubDate>Mon, 08 May 2017 10:19:00 +0800</pubDate><description><![CDATA[题意：给定一颗n个节点的树，然后是m个询问，每个询问是两个集合，问分别在这两个集合中取一个点，这两个点的LCA 的深度最大为多少。
分析：首先想到的肯定是for两个集合，O(k^2)，肯定要爆炸。我们对这棵树进行树链剖分，剖完之后的树最多有logn条链，那么，我们将这两个集合中的点，根据他们所在的链分类，如果两个点位于同一条链，我们取深度更深的那个点，这样处理之后，每个集合中最多只有logn个点]]></description><category></category></item></channel></rss>