<?xml version="1.0" encoding="utf-8" ?><rss version="2.0"><channel><title><![CDATA[qq_45891413的博客]]></title><description><![CDATA[]]></description><link>https://blog.csdn.net/qq_45891413</link><language>zh-cn</language><generator>https://blog.csdn.net/</generator><copyright><![CDATA[Copyright &copy; qq_45891413]]></copyright><item><title><![CDATA[LeetCode 678. 有效的括号字符串 括号序列+栈]]></title><link>https://blog.csdn.net/qq_45891413/article/details/114287435</link><guid>https://blog.csdn.net/qq_45891413/article/details/114287435</guid><author>qq_45891413</author><pubDate>Tue, 02 Mar 2021 16:05:39 +0800</pubDate><description><![CDATA[题目链接
class Solution {
public:
    bool checkValidString(string s) {
        stack&lt;int&gt;st;
        stack&lt;int&gt;st1;
        int len=s.size();
        for(int i=0;i&lt;len;i++){
            if(s[i]=='(')
                st.push(i);
            else]]></description><category></category></item><item><title><![CDATA[LeetCode 672. 灯泡开关 Ⅱ]]></title><link>https://blog.csdn.net/qq_45891413/article/details/114260189</link><guid>https://blog.csdn.net/qq_45891413/article/details/114260189</guid><author>qq_45891413</author><pubDate>Mon, 01 Mar 2021 12:37:05 +0800</pubDate><description><![CDATA[题目链接
class Solution {
public:
    //12-3;
    //13-2;
    //23-1;
    //0 1 2 3 4 14 24 34 
    int state[8][6]={
        {1,1,1,1,1,1},
        {0,0,0,0,0,0},
        {1,0,1,0,1,0},
        {0,1,0,1,0,1},
        {0,1,1,0,1,1},
        {1,0,0,1,0,0},
    ]]></description><category></category></item><item><title><![CDATA[acwing 1230. K倍区间 前缀和+同余]]></title><link>https://blog.csdn.net/qq_45891413/article/details/113847951</link><guid>https://blog.csdn.net/qq_45891413/article/details/113847951</guid><author>qq_45891413</author><pubDate>Thu, 18 Feb 2021 15:47:11 +0800</pubDate><description><![CDATA[题目链接
#include&lt;bits/stdc++.h&gt;
using namespace std;
const int N=100100; ;
long long res=0,cnt[N],s[N];
int main(){
    int n,k;
    cin&gt;&gt;n&gt;&gt;k;
    for(int i=1;i&lt;=n;i++){
        cin&gt;&gt;s[i];
        s[i]+=s[i-1];
    }
    cnt[0]=1;
]]></description><category></category></item><item><title><![CDATA[acwing 1414. 牛异或 异或前缀和+trie树]]></title><link>https://blog.csdn.net/qq_45891413/article/details/113835634</link><guid>https://blog.csdn.net/qq_45891413/article/details/113835634</guid><author>qq_45891413</author><pubDate>Wed, 17 Feb 2021 17:19:42 +0800</pubDate><description><![CDATA[题目链接
对于异或来说，组成前缀和数组时应该对上一位取异或值，在判断范围[i,j]时会与普通前缀和相同：
普通的前缀和sum=w[j]-w[i-1],但是异或区间的前缀和是sum=w[j]^w[i-1]
因为如果在数组中遍历两遍的端点，时间复杂度是on2的，所以需要使用01trie来维护。
对于每个点都insert到trie中创建当前的空间和记录当前的位置，每次插入一个就query一次寻找当前长度中最长的异或值，如果当前点有分支的话就走到不同分支，否则就走到相同分支
#include&lt;bits/std]]></description><category></category></item><item><title><![CDATA[acwing 1102. 移动骑士 马走日bfs]]></title><link>https://blog.csdn.net/qq_45891413/article/details/113587590</link><guid>https://blog.csdn.net/qq_45891413/article/details/113587590</guid><author>qq_45891413</author><pubDate>Wed, 03 Feb 2021 10:36:13 +0800</pubDate><description><![CDATA[题目链接
总共8个方向
#include&lt;bits/stdc++.h&gt;
using namespace std;
const int N=350;
typedef pair&lt;int, int&gt; PII;
PII a,b;
int n,m,d;
int dist[N][N];
int bfs(PII start,PII end){
    if(start==end) return 0;
    queue&lt;PII&gt;qu;
    qu.push(start);
    m]]></description><category></category></item><item><title><![CDATA[acwing 1613. 数独简单版 DFS爆搜]]></title><link>https://blog.csdn.net/qq_45891413/article/details/113573989</link><guid>https://blog.csdn.net/qq_45891413/article/details/113573989</guid><author>qq_45891413</author><pubDate>Tue, 02 Feb 2021 20:58:11 +0800</pubDate><description><![CDATA[题目连接

数独问题，需要在横、纵、每9个方格之中填1到9数字。我们可以构建一棵dfs树，对于每一个节点要求满足以上三总条件才可以更新这一个点，如果这个点可以走下去那么就深度搜索下去，并且更新当点的状态以此复原现场。
y总代码
#include&lt;bits/stdc++.h&gt;
using namespace std;
const int N=10;
char g[N][N];
bool row[N][N],col[N][N],cell[3][3][N];
bool dfs(int x,int y)]]></description><category></category></item><item><title><![CDATA[acwing 1402. 星空之夜 哈希+连通块]]></title><link>https://blog.csdn.net/qq_45891413/article/details/113545955</link><guid>https://blog.csdn.net/qq_45891413/article/details/113545955</guid><author>qq_45891413</author><pubDate>Tue, 02 Feb 2021 11:26:43 +0800</pubDate><description><![CDATA[题目链接
对于结构特别的连通块可以将它的每个点到其他点的距离之和作为hash值
并且在判断浮点数是否出现过时，应该比较fabs的差值
#include&lt;bits/stdc++.h&gt;
#define lowbit(x) x&amp;(-x)
#define x first
#define y second
using namespace std;
typedef pair&lt;int,int&gt;PII;
const int N=110;
const double eps=1e-6;
int ]]></description><category></category></item><item><title><![CDATA[acwing 243. 一个简单的整数问题2 树状数组 区间操作]]></title><link>https://blog.csdn.net/qq_45891413/article/details/113384776</link><guid>https://blog.csdn.net/qq_45891413/article/details/113384776</guid><author>qq_45891413</author><pubDate>Fri, 29 Jan 2021 14:08:03 +0800</pubDate><description><![CDATA[题目链接
树状数组对于单点操作只需要开一个树状数组就可以了，但是对于区间的整体进行修改需要开两个树状数组，通过差分操作去维护，一个维护bi，一个维护bi×i
#include &lt;bits/stdc++.h&gt;
using namespace std;
#define ll long long
#define lowbit(x) x&amp;(-x)
const int N=2e5;
ll c1[N],c2[N],n,m,a[N];
inline void add(ll x,ll v){
    f]]></description><category></category></item><item><title><![CDATA[acwing 482. 合唱队形 最长上升子序列+最长下降子序列 寒假集训]]></title><link>https://blog.csdn.net/qq_45891413/article/details/113271795</link><guid>https://blog.csdn.net/qq_45891413/article/details/113271795</guid><author>qq_45891413</author><pubDate>Wed, 27 Jan 2021 20:51:22 +0800</pubDate><description><![CDATA[题目链接
假设中间有一个数n，那么排队的最多人数就是它左边的最长上升子序列和它右边的最长下降子序列的和。我们把每个点上的点作为中间的点去做同样的操作，取两个值的和的最大值
#include&lt;bits/stdc++.h&gt;
using namespace std;
const int maxn=500;
int a[maxn],dp[maxn],dp1[maxn];
int main(){
    int n,id,mx;
    cin&gt;&gt;n;
    for(int i=1;i&lt]]></description><category></category></item><item><title><![CDATA[acwing 297. 赤壁之战 树状数组优化DP 寒假集训]]></title><link>https://blog.csdn.net/qq_45891413/article/details/113264323</link><guid>https://blog.csdn.net/qq_45891413/article/details/113264323</guid><author>qq_45891413</author><pubDate>Wed, 27 Jan 2021 19:14:06 +0800</pubDate><description><![CDATA[题目链接
想要求长度为M的子序列，我们可以拿DP方程来计算，并且这个DP也是比较好看出来的DP[i][j]代表着i后j位置中的所有长度为j的子序列，递推方程为
for(int i=1;i&lt;=n;i++){
	for(int j=2;j&lt;=m;j++){
		for(int k=1;k&lt;i;k++){
			if(a[k]&lt;a[i]) dp[i][j]+=dp[k][j-1]
			}
		}
	}
}

的一个三重循环，但是n^3的暴力一定是会超时的，所以我们可以用树状数组来优化一个]]></description><category></category></item><item><title><![CDATA[K Smallest Sums UVA - 11997 贪心+优先队列  寒假集训]]></title><link>https://blog.csdn.net/qq_45891413/article/details/113191819</link><guid>https://blog.csdn.net/qq_45891413/article/details/113191819</guid><author>qq_45891413</author><pubDate>Tue, 26 Jan 2021 20:30:30 +0800</pubDate><description><![CDATA[题目链接
这道题网上说的奇奇怪怪，在加上我地址符看不太懂，所以比较难以理解
其实原理比较简单，我们先把所有的数组进行sort，并将第一个数组命名为A数组，后面的命名为Bn数组，那么我们利用优先队列进行选择最优解，就是一直用B数组去维护A数组。
将A1去加上B1到n所有数并放入优先队列，同样一直遍历到An去加上B1到n的值放入优先队列，这样我们取A的前n个作为维护后新的A数组，重复这样的操作到Bn这样答案就是数组A的所有值了。
这里有个小问题，如果你不断把A1加B1到n的值，An加B1到n的值放入队列，再去取]]></description><category></category></item><item><title><![CDATA[power oj 2920: 第K大1.0  优先队列]]></title><link>https://blog.csdn.net/qq_45891413/article/details/113191143</link><guid>https://blog.csdn.net/qq_45891413/article/details/113191143</guid><author>qq_45891413</author><pubDate>Tue, 26 Jan 2021 20:15:19 +0800</pubDate><description><![CDATA[题目链接
题意是在一组数组里面，对每一个数求它右边的最大值。
题解：我们把可以不断将数字都放进一个优先队列里面，做一个在线操作：对于每一次放入a[i]的数，通过比较将队列前面比他小的所有数字弹出，记录这些数字被弹出的次数。
如果==3就直接用数组记录这个数右边第k个数的下标为i，如果不等于3就将它暂且放在一个双端队列中（至于为什么是deque,是因为比较好操作，用queue或者stack都是可以的）。
在这个放入的a[i]将它前面所有的数字都弹出并标记后，我们把在deque中的所有数字再放回优先队列中，因为]]></description><category></category></item><item><title><![CDATA[acwing 1432. 棋盘挑战 DFS爆搜]]></title><link>https://blog.csdn.net/qq_45891413/article/details/113001856</link><guid>https://blog.csdn.net/qq_45891413/article/details/113001856</guid><author>qq_45891413</author><pubDate>Fri, 22 Jan 2021 20:47:48 +0800</pubDate><description><![CDATA[给定一个 N×N 的棋盘，请你在上面放置 N 个棋子，要求满足：
每行每列都恰好有一个棋子
每条对角线上都最多只能有一个棋子
1   2   3   4   5   6
1 |   | O |   |   |   |   |
2 |   |   |   | O |   |   |
3 |   |   |   |   |   | O |
4 | O |   |   |   |   |   |
5 |   |   | O |   |   |   |
6 |   |   |   |   | O |   |
上图给]]></description><category></category></item><item><title><![CDATA[Round Numbers POJ - 3252 01二进制 数位DP 寒假集训]]></title><link>https://blog.csdn.net/qq_45891413/article/details/113001663</link><guid>https://blog.csdn.net/qq_45891413/article/details/113001663</guid><author>qq_45891413</author><pubDate>Fri, 22 Jan 2021 20:43:58 +0800</pubDate><description><![CDATA[The cows, as you know, have no fingers or thumbs and thus are unable to play Scissors, Paper, Stone’ (also known as ‘Rock, Paper, Scissors’, ‘Ro, Sham, Bo’, and a host of other names) in order to make arbitrary decisions such as who gets to be milked first]]></description><category></category></item><item><title><![CDATA[P1886 滑动窗口 /【模板】单调队列 寒假集训]]></title><link>https://blog.csdn.net/qq_45891413/article/details/113001335</link><guid>https://blog.csdn.net/qq_45891413/article/details/113001335</guid><author>qq_45891413</author><pubDate>Fri, 22 Jan 2021 20:37:13 +0800</pubDate><description><![CDATA[有一个长为 nn 的序列 aa，以及一个大小为 kk 的窗口。现在这个从左边开始向右滑动，每次滑动一个单位，求出每次滑动后窗口中的最大值和最小值。
例如：
The array is [1,3,-1,-3,5,3,6,7][1,3,−1,−3,5,3,6,7], and k = 3k=3。

输入格式
输入一共有两行，第一行有两个正整数 n,kn,k。 第二行 nn 个整数，表示序列 aa
输出格式
输出共两行，第一行为每次窗口滑动的最小值
第二行为每次窗口滑动的最大值
输入输出样例
输入 #1复制
8 3
]]></description><category></category></item><item><title><![CDATA[Subsequence HDU - 3530 维护区间最大差值 单调队列 寒假集训]]></title><link>https://blog.csdn.net/qq_45891413/article/details/113001224</link><guid>https://blog.csdn.net/qq_45891413/article/details/113001224</guid><author>qq_45891413</author><pubDate>Fri, 22 Jan 2021 20:35:01 +0800</pubDate><description><![CDATA[There is a sequence of integers. Your task is to find the longest subsequence that satisfies the following condition: the difference between the maximum element and the minimum element of the subsequence is no smaller than m and no larger than k.
Input
The]]></description><category></category></item><item><title><![CDATA[Balanced Number HDU - 3709 寻找力矩 数位DP 寒假集训]]></title><link>https://blog.csdn.net/qq_45891413/article/details/113001042</link><guid>https://blog.csdn.net/qq_45891413/article/details/113001042</guid><author>qq_45891413</author><pubDate>Fri, 22 Jan 2021 20:29:15 +0800</pubDate><description><![CDATA[A balanced number is a non-negative integer that can be balanced if a pivot is placed at some digit. More specifically, imagine each digit as a box with weight indicated by the digit. When a pivot is placed at some digit of the number, the distance from a ]]></description><category></category></item><item><title><![CDATA[Bomb HDU - 3555 出现多少个49，数位DP， 寒假集训]]></title><link>https://blog.csdn.net/qq_45891413/article/details/113000816</link><guid>https://blog.csdn.net/qq_45891413/article/details/113000816</guid><author>qq_45891413</author><pubDate>Fri, 22 Jan 2021 20:25:28 +0800</pubDate><description><![CDATA[反恐精英在尘土中发现了一枚定时炸弹。但这次恐怖分子改进了定时炸弹。定时炸弹的编号顺序从1到N计数。如果当前的编号顺序包括(子串!!)“49”，爆炸威力将增加一个点。
问最后爆炸的时候威力为多少。
输入描述
输入T代表T组(T &lt;= 1e4)
每组输入一个n(1 &lt;= n&lt;=2^63 - 1)
输出描述
输出爆炸的威力
样例输入
1
1
样例输出
0
区间里面的数字间出现了多少个49，数位dp板子
#include &lt;stdio.h&gt;
#include &lt;string.h&]]></description><category></category></item><item><title><![CDATA[Dire Wolf HDU - 5115  区间DP，寒假集训]]></title><link>https://blog.csdn.net/qq_45891413/article/details/113000482</link><guid>https://blog.csdn.net/qq_45891413/article/details/113000482</guid><author>qq_45891413</author><pubDate>Fri, 22 Jan 2021 20:22:55 +0800</pubDate><description><![CDATA[有n头狼排成一排，每只狼两个属性，攻击力和加成值，狼的实际攻击力等于自身攻击力加相邻狼的加成值，被杀死之后的狼对相邻的狼的攻击力的加成会被取消，同时，原先与 被杀死的狼相邻的两头狼会变成相邻的狼。问杀死所有狼受到的伤害值最小是。
Input
多组输入，第一行一个T
每组输入一个n(n &lt;= 200)
输入n个数，代表每只狼的攻击力(0&lt;=a[i] &lt;=1e5)
输入n个数，代表每只狼的加成值(0&lt;=b[i]&lt;=5e4)
Output
每组样例输出一个Case，然后输出答案。
S]]></description><category></category></item><item><title><![CDATA[X mod f(x) HDU - 4389  数位DP  寒假集训]]></title><link>https://blog.csdn.net/qq_45891413/article/details/113000038</link><guid>https://blog.csdn.net/qq_45891413/article/details/113000038</guid><author>qq_45891413</author><pubDate>Fri, 22 Jan 2021 20:09:20 +0800</pubDate><description><![CDATA[定义一个函数 f(x):
int f ( int x ) {
　　　if ( x == 0 ) return 0;
　　　return f(x/10) + x%10;
}
现在，我们有个区间 (1 &lt;= A &lt;= B &lt;= 10 9), 查询有多少个整数 x mod f(x) 等于 0.
Input
第一行是一个整数 T (1 &lt;= T &lt;= 50), 表示数据组数。
接下来 T 行每行包含两个整数 A B (1 &lt;= A &lt;= B &lt;= 10 9)
Outp]]></description><category></category></item></channel></rss>