摘要:
lianjie 注意设置标志的妙用,在重复判断边界中,设置一个越界岗哨可以避免重复的判断。把越界位置根据题意设置成inf,就不用一次次的判断 #include<bits/stdc++.h> #define ll long long using namespace std; int n; const 阅读全文
摘要:
newcode dfs的时候,先想搜的是什么。 1.规定——每次都搜待搜索的点 2.dfs进去后先写边界条件 3.还原现场 #include<bits/stdc++.h> #define ll long long using namespace std; const int N=100,Mod=1e 阅读全文
摘要:
newcode 三维:要从头跑到尾,才能把整个dp更新完整,不然dp更新不完整 #include<bits/stdc++.h> #define ll long long using namespace std; int n,H,S; ll h[1010],s[1010],w[1010]; ll dp 阅读全文
摘要:
归并排序实际上也是把序列进行了分块,二分分块。 树状数组也是分块。 先分再合。 分到底的序列就是原序列 #include<bits/stdc++.h> #define ll long long using namespace std; const int N=1e5+100; int a[N],n, 阅读全文
摘要:
邻接矩阵表示的图: 油田 dfs #include<bits/stdc++.h> using namespace std; const int maxn=104; char G[maxn][maxn]; int n,m; int ans=0; int x[8]={0,0,-1,1,1,1,-1,-1 阅读全文