- 博客(7)
- 资源 (1)
- 收藏
- 关注
原创 HDU 5699 货物运输 ( 二分 + 不等式判断 )
思路: http://blog.csdn.net/tc_to_top/article/details/51476095 代码: #include using namespace std; const int MAXN=1e6+7; const int INF=0x3f3f3f3f; int st[MAXN],en[MAXN],n,m; bool judge(int mid){
2017-09-23 23:56:34 412
原创 HDU - 1231 最大连续子序列 (前缀和)
题意: 中文 思路: 维护前缀和,最小前缀和,可以计算出每个右端点的最大子序列。 代码: #include using namespace std; const int MAXN=1e4+7; int a[MAXN],b[MAXN]={0},c[MAXN]; int main() { int n; while(scanf("%d",&n)&&n){ f
2017-09-21 13:02:32 895
原创 最大最小元问题
一个简陋的nlogn最大最小元 代码: #include using namespace std; #define ls l,mid #define rs mid+1,r #define mi (l+r)/2 const int MAXN=1e6+7; int a[MAXN]; int maxn(int l,int r){ if(l==r) return a[l]; int
2017-09-18 15:00:02 749
原创 归并排序
一个丑陋的归并排序 #include using namespace std; #define ls l,mid #define rs mid+1,r #define mi (l+r)/2 const int MAXN=1e6+7; int a[MAXN],b[MAXN]; void conbine(int l,int mid,int r){ int lp=l,rp=mid+1,pos
2017-09-18 14:58:51 463
原创 棋盘覆盖问题
题意: 经典棋盘覆盖问题 代码: #include using namespace std; const int MAXN=5e3; int n,posx,posy; int mp[MAXN][MAXN]; int two[15]; /* 1: #* ** 2: ** #* 3: *# ** 4: ** *# */ void show(){ for(int i
2017-09-18 14:56:53 469
原创 HDU 6191 Query on A Tree ( DFS序 + 可持久化字典树 )
题意: 给出一颗带点权树,问在某点的子树中与 X 的最大异或值是多少? 思路: DFS序后,转化为区间与 X 异或求最大,可持久化字典树思路同主席树,每次更新一条链即可。 代码: #include using namespace std; const int MAXN=1e5+7; int two[35]; int a[MAXN],fa[MAXN],n,m,in[MAXN],out[M
2017-09-14 08:13:50 363
原创 HDU 6203 ping ping ping (LCA+DFS序)
思路参考:http://blog.csdn.net/DorMOUSENone/article/details/77929604 题意: n+1 个点 n 条边的树(点标号 0 ~ n),有若干个点无法通行,导致 p 组 U V 无法连通。问无法通行的点最少有多少个。 思路:
2017-09-11 23:34:02 606
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人