<?xml version="1.0" encoding="utf-8" ?><rss version="2.0"><channel><title><![CDATA[albertluf的博客]]></title><description><![CDATA[]]></description><link>https://blog.csdn.net/albertluf</link><language>zh-cn</language><generator>https://blog.csdn.net/</generator><copyright><![CDATA[Copyright &copy; albertluf]]></copyright><item><title><![CDATA[牛客练习赛45]]></title><link>https://blog.csdn.net/albertluf/article/details/89812035</link><guid>https://blog.csdn.net/albertluf/article/details/89812035</guid><author>albertluf</author><pubDate>Sat, 04 May 2019 12:19:09 +0800</pubDate><description><![CDATA[A QAQ:

dp[i][0]表示前i个字符可以组成的"Q",dp[i][1]表示前i个字符可以组成的"QA",dp[i][2]表示前i个字符可以组成的"QAQ"。扫一遍即可。


#include&lt;bits/stdc++.h&gt;
using namespace std;
#define ll long long
const int maxn=1e5+10;
char t[5005]...]]></description><category></category></item><item><title><![CDATA[Wannafly挑战赛1 C:MMSet2]]></title><link>https://blog.csdn.net/albertluf/article/details/88978382</link><guid>https://blog.csdn.net/albertluf/article/details/88978382</guid><author>albertluf</author><pubDate>Tue, 02 Apr 2019 18:43:14 +0800</pubDate><description><![CDATA[题面

最优的点一定在给定点集中最远的两点的简单路径上。


#include&lt;bits/stdc++.h&gt;
using namespace std;
const int maxn=3e5+10;
int head[maxn],To[maxn*2],Next[maxn*2],tol;
void add_edge(int x,int y)
{
    To[tol]=y;
    Nex...]]></description><category></category></item><item><title><![CDATA[Codeforces Round #549 (Div. 1) B. Lynyrd Skynyrd(倍增)]]></title><link>https://blog.csdn.net/albertluf/article/details/88978338</link><guid>https://blog.csdn.net/albertluf/article/details/88978338</guid><author>albertluf</author><pubDate>Tue, 02 Apr 2019 18:40:03 +0800</pubDate><description><![CDATA[题面

按照贪心策略，枚举以每个位置为结尾，则往前遍历，找到它的前一个数字最近的出现位置，然后往前跳n-1步，倍增判断一下

跳到了哪个点。然后线段树查询一下区间最大值即可。


#include&lt;bits/stdc++.h&gt;
using namespace std;
const int maxn=2e5+10;
vector&lt;int&gt;G[maxn];
int n,m,Q,...]]></description><category></category></item><item><title><![CDATA[牛客挑战赛30 C-小G砍树(换根)]]></title><link>https://blog.csdn.net/albertluf/article/details/88369437</link><guid>https://blog.csdn.net/albertluf/article/details/88369437</guid><author>albertluf</author><pubDate>Sat, 09 Mar 2019 18:10:02 +0800</pubDate><description><![CDATA[题面

先考虑1号店最后移除时候的贡献，我们可以钦定1号点为根，并钦定他最后移除

然后就是一个树形dp

设fifi表示i号点子树移除方案数量，sizeisizei表示1为根时子树大小

显然有dp式子fx=(sizex−1)!∏(sizei)!∏fifx=(sizex−1)!∏(sizei)!∏fi(满足1为根时x是i的爹)

然后最后移除点1的情况的贡献就算出来了

我们考虑换根

先考虑...]]></description><category></category></item><item><title><![CDATA[BZOJ 4423: [AMPPZ2013]Bytehattan(对偶图+并查集维护连通性)]]></title><link>https://blog.csdn.net/albertluf/article/details/86663717</link><guid>https://blog.csdn.net/albertluf/article/details/86663717</guid><author>albertluf</author><pubDate>Sun, 27 Jan 2019 09:58:25 +0800</pubDate><description><![CDATA[题面


/*
转成对偶图，若删这条边之前此边对应对偶图中的两个点已经联通，
则对偶图中这两点在连一条边就形成了一个割，所以删除这条边两点不连通。
*/
#include&amp;lt;bits/stdc++.h&amp;gt;
using namespace std;
const int maxn=3e6+10;
int par[maxn],n,k;
int Find(int x)
{
    if(x==pa...]]></description><category></category></item><item><title><![CDATA[hdu 6184 Counting Stars(三元环计数)]]></title><link>https://blog.csdn.net/albertluf/article/details/86556105</link><guid>https://blog.csdn.net/albertluf/article/details/86556105</guid><author>albertluf</author><pubDate>Sat, 19 Jan 2019 19:56:34 +0800</pubDate><description><![CDATA[题目链接

题解链接


#include&amp;lt;bits/stdc++.h&amp;gt;
using namespace std;
const int maxn=2e5+10;
int n,m,from[maxn],to[maxn];
vector&amp;lt;int&amp;gt;G[maxn],s[maxn];
int in[maxn],re[maxn],rev[maxn],val[maxn];
int mai...]]></description><category></category></item><item><title><![CDATA[hdu 6191 Query on A Tree(字典树+启发式合并)]]></title><link>https://blog.csdn.net/albertluf/article/details/86530981</link><guid>https://blog.csdn.net/albertluf/article/details/86530981</guid><author>albertluf</author><pubDate>Thu, 17 Jan 2019 20:38:48 +0800</pubDate><description><![CDATA[题目链接

每个节点建一颗字典树，启发式合并就好了。

内存n*logn*logn,内存超限，考虑合并完之后废弃的字典树的节点存一下，后面再次利用。


#include&amp;lt;bits/stdc++.h&amp;gt;
using namespace std;
#define ll long long
const int maxn=1e5+10;
int tree[maxn*55][2],a[maxn]...]]></description><category></category></item><item><title><![CDATA[hihoCoder #1048 : 状态压缩·二]]></title><link>https://blog.csdn.net/albertluf/article/details/86530890</link><guid>https://blog.csdn.net/albertluf/article/details/86530890</guid><author>albertluf</author><pubDate>Thu, 17 Jan 2019 20:33:30 +0800</pubDate><description><![CDATA[链接：http://hihocoder.com/problemset/problem/1048

题解：https://blog.csdn.net/my_sunshine26/article/details/74612684


#include&amp;lt;bits/stdc++.h&amp;gt;
using namespace std;
const int mod=1000000007;
int dp[1...]]></description><category></category></item><item><title><![CDATA[Codeforces Round #519 by Botan Investments]]></title><link>https://blog.csdn.net/albertluf/article/details/84317546</link><guid>https://blog.csdn.net/albertluf/article/details/84317546</guid><author>albertluf</author><pubDate>Wed, 21 Nov 2018 14:09:50 +0800</pubDate><description><![CDATA[题目：http://codeforces.com/contest/1043

A. Elections

枚举k的值


#include&amp;lt;bits/stdc++.h&amp;gt;
using namespace std;
int n,a[105];
int work()
{
    int sum=0,ma=0;
    for(int i=1;i&amp;lt;=n;i++)
        sum+...]]></description><category></category></item><item><title><![CDATA[BZOJ 1013: [JSOI2008]球形空间产生器sphere（高斯消元）]]></title><link>https://blog.csdn.net/albertluf/article/details/83655240</link><guid>https://blog.csdn.net/albertluf/article/details/83655240</guid><author>albertluf</author><pubDate>Fri, 02 Nov 2018 14:46:31 +0800</pubDate><description><![CDATA[题目：https://www.lydsy.com/JudgeOnline/problem.php?id=1013


思路：
存在二次项，考虑两式相减可以把所有未知数的二次项消掉，
n+1 个等式用第一个与后面的做差，形成n个不等式，然后
高斯消元即可。

代码：

#include&amp;lt;cstdio&amp;gt;
#include&amp;lt;cmath&amp;gt;
#include&amp;lt;algorithm...]]></description><category></category></item><item><title><![CDATA[BZOJ 2648: SJY摆棋子(kd tree)]]></title><link>https://blog.csdn.net/albertluf/article/details/83413031</link><guid>https://blog.csdn.net/albertluf/article/details/83413031</guid><author>albertluf</author><pubDate>Fri, 26 Oct 2018 12:18:24 +0800</pubDate><description><![CDATA[题目：https://www.lydsy.com/JudgeOnline/problem.php?id=2648


#include&amp;lt;bits/stdc++.h&amp;gt;
using namespace std;
const int inf = 0x3f3f3f3f;
const int maxn=1e6+100;
int idx,n,m,tol,ans;
struct node
{
   ...]]></description><category></category></item><item><title><![CDATA[hdu 4347 The Closest M Points （kd tree 模板题）]]></title><link>https://blog.csdn.net/albertluf/article/details/83412992</link><guid>https://blog.csdn.net/albertluf/article/details/83412992</guid><author>albertluf</author><pubDate>Fri, 26 Oct 2018 12:12:32 +0800</pubDate><description><![CDATA[题目：http://acm.hdu.edu.cn/showproblem.php?pid=4347


#include&amp;lt;bits/stdc++.h&amp;gt;
using namespace std;
#define sq(x) (x)*(x)
const int maxn=6e4+10;
int idx,n,k,m,lson[maxn],rson[maxn],tol;
struct node...]]></description><category></category></item><item><title><![CDATA[codeforces 1040E. Network Safety]]></title><link>https://blog.csdn.net/albertluf/article/details/82454784</link><guid>https://blog.csdn.net/albertluf/article/details/82454784</guid><author>albertluf</author><pubDate>Thu, 06 Sep 2018 10:08:04 +0800</pubDate><description><![CDATA[题目：http://codeforces.com/contest/1040/problem/E

思路：

若x,y之间有一条边，权值分别为a[x],a[y], 设t=a[x]^a[y],

则只有a[x]^t==a[y],a[y]^t==a[x],因此只有其中一个数

异或上t才是不安全的，两个数都异或上t则相当于交换

x,y。可以按0~(1&amp;lt;&amp;lt;k)-1逐个考虑每个x,若x==t时...]]></description><category></category></item><item><title><![CDATA[codeforces 1037F. Maximum Reduction(启发式合并)]]></title><link>https://blog.csdn.net/albertluf/article/details/82386046</link><guid>https://blog.csdn.net/albertluf/article/details/82386046</guid><author>albertluf</author><pubDate>Tue, 04 Sep 2018 16:39:30 +0800</pubDate><description><![CDATA[题目：http://codeforces.com/contest/1037/problem/F

思路：
找出最大的一个点(值相同时取左边的点)，计算以此点为最大值
能够形成多少个合法的区间，然后处理该点左右两个区间，一直递归下去。
假设以i为左端点，合法的右端点有i+(k-1),i+2*(k-1),i+3*(k-1),i+4*(k-1)
i+t*(k-1)不能超过区间的范围。


#includ...]]></description><category></category></item><item><title><![CDATA[2017 CCPP 秦皇岛]]></title><link>https://blog.csdn.net/albertluf/article/details/82313142</link><guid>https://blog.csdn.net/albertluf/article/details/82313142</guid><author>albertluf</author><pubDate>Sun, 02 Sep 2018 10:20:28 +0800</pubDate><description><![CDATA[题目：链接

A - Balloon Robot

设机器人从0位置出发， 对于每一个a[i],b[i]算出b[i]时间机器人与s[a[i]]的距离，即所需等待时间，

此时如果将机器人位置向前推进1，则它越过的t[i]时间都会加上m，因为要相遇就要多走一圈，

然后所有的等待时间-1。

代码：


#include&amp;lt;bits/stdc++.h&amp;gt;
using namespace st...]]></description><category></category></item><item><title><![CDATA[2018 icpc 南京网络赛]]></title><link>https://blog.csdn.net/albertluf/article/details/82291234</link><guid>https://blog.csdn.net/albertluf/article/details/82291234</guid><author>albertluf</author><pubDate>Sat, 01 Sep 2018 22:37:00 +0800</pubDate><description><![CDATA[题目：链接

A. An Olympian Math Problem

输出n-1即可(女朋友猜的)。


#include&amp;lt;bits/stdc++.h&amp;gt;
using namespace std;
#define ll long long
ll fac[103];
int main()
{
    ll n,T;cin&amp;gt;&amp;gt;T;
    while(T--)
    {
  ...]]></description><category></category></item><item><title><![CDATA[2017 icpc 沈阳现场赛]]></title><link>https://blog.csdn.net/albertluf/article/details/82228748</link><guid>https://blog.csdn.net/albertluf/article/details/82228748</guid><author>albertluf</author><pubDate>Thu, 30 Aug 2018 23:18:56 +0800</pubDate><description><![CDATA[题目：链接

F Heron and His Triangle:

暴力跑了几发，把搞出来的数扔进oeis里发现对于条件成立的t数组

有t[i]=4*t[i-1]-t[i-2]。因此找到第一个大于等于N的t[i]就好了。

但是数值范围超过了long long，因此要用大数，这样一个个找

过去会超时，可以先对询问排序，这样下次的询问就可以接着

上次的位置寻找。

代码：


#include...]]></description><category></category></item><item><title><![CDATA[2017 icpc 沈阳网络赛]]></title><link>https://blog.csdn.net/albertluf/article/details/82228386</link><guid>https://blog.csdn.net/albertluf/article/details/82228386</guid><author>albertluf</author><pubDate>Thu, 30 Aug 2018 22:08:30 +0800</pubDate><description><![CDATA[题目：链接

B cable cable cable:

观察得，答案为K*(M-K+1)


#include&amp;lt;bits/stdc++.h&amp;gt;
using namespace std;
#define ll long long
int main()
{
    ll M,K;
    while(~scanf(&quot;%lld%lld&quot;,&amp;amp;M,&amp;amp;K))
        pri...]]></description><category></category></item><item><title><![CDATA[2017 CCPC 杭州赛区]]></title><link>https://blog.csdn.net/albertluf/article/details/82143224</link><guid>https://blog.csdn.net/albertluf/article/details/82143224</guid><author>albertluf</author><pubDate>Tue, 28 Aug 2018 12:34:14 +0800</pubDate><description><![CDATA[题面：http://acm.hdu.edu.cn/downloads/CCPC2018-Hangzhou-ProblemSet.pdf

Problem A. Super-palindrome：

每个奇数长度的子串都是回文，有两种情况：

1. aaaaaaa 都是相同字符

2.ababababab 两个不同的字符一直交替。

枚举每两个字符即可。

代码：


#include&amp;lt;bit...]]></description><category></category></item><item><title><![CDATA[codeforce 1027 F. Session in BSU]]></title><link>https://blog.csdn.net/albertluf/article/details/81975798</link><guid>https://blog.csdn.net/albertluf/article/details/81975798</guid><author>albertluf</author><pubDate>Thu, 23 Aug 2018 10:19:45 +0800</pubDate><description><![CDATA[F. Session in BSU

time limit per test

4 seconds

memory limit per test

256 megabytes

input

standard input

output

standard output

Polycarp studies in Berland State University. Soon he will have...]]></description><category></category></item></channel></rss>