HDU - 7125 Master of Shuangpin】的更多相关文章

Super-palindrome 题面地址:http://acm.hdu.edu.cn/downloads/CCPC2018-Hangzhou-ProblemSet.pdf 这道题是差分数组的题目,线段树也可以写,但是代码太长没必要. 代码: #include<iostream> #include<cstdio> #include<cstring> #include<cstdlib> #include<algorithm> #include<…
首先给出定义 点分治是一种处理树上路径的工具 挂出一道题目来:Master of Subgraph 这道题目让你求所有联通子图加和所能产生数字,问你1到m之间,那些数字可以被产生 这道题目,假如我们利用暴力的方法去求解的话 实际上是对每个节点进行一次dfs,这样的话会发现复杂度为O(N^2)也就是再9e6左右,再加上常数M/64,复杂度根本不够(9e9) 我们可以利用点分治去优化复杂度 点分治的原理就是树上的路径产生的答案,不是在经过这个节点的就是在不经过这个节点的,那我们找到树的重心的话,就能…
题目链接  2017 CCPC Hangzhou Problem H 思路:对树进行分块.把第一棵树分成$\sqrt{n}$块,第二棵树也分成$\sqrt{n}$块.    分块的时候满足每个块是一个连通块,那么每个块就有一个共同的祖先. 把询问按照第一个点被第一棵树的哪个祖先管辖和第二个点被第二棵树的哪个祖先管辖,分成$n$类. 每一类询问一起处理,处理完后用可撤销并查集恢复到之前的状态. 每一类询问之间依次转移,每次转移,移动次数不会超过$\sqrt{n}$次. 最后总时间复杂度$O(n^{…
题目链接  2017 CCPC Hangzhou  Problem E 题意  给定一棵树,每个点有一个权值,现在我们可以选一些连通的点,并且把这点选出来的点的权值相加,得到一个和. 求$[1, m]$里面哪些值可以被表示成选出来的点的权值和.用$01$序列的方式输出. 重现赛赛场上的我英勇无畏,大胆做$3000$次FFT合并两个bitset表示的答案. 然后TLE到结束(活该) 其实这个题确实要用bitset,关键是能不能把合并两个bitset转化成合并一个数和一个bitset. 考虑点分治.…
题意 两个1e5的数组a,b,定义\(S(t)=\left \lfloor \frac{t-b_i}{a_i} \right \rfloor\),有三个操作 1 x y:将\(a[x]\)变为\(y\) 2 x y:将\(b[x]\)变为\(y\) 3 x:求使得\(S(t)\geq k\)的最小\(k\) 其中\(a_i\leq 1000\),\(b_i,k\leq 1e9\) 思路 这题主要突破口在于\(a_i\leq 1000\) 我们先从下整除下手, \(\left \lfloor \f…
You are given a tree with n nodes. The weight of the i-th node is wi. Given a positive integer m, now you need to judge that for every integer i in [1,m] whether there exists a connected subgraph which the sum of the weights of all nodes is equal to…
Mart Master II Time Limit: 6000ms Memory Limit: 65536KB This problem will be judged on HDU. Original ID: 501664-bit integer IO format: %I64d      Java class name: Main Trader Dogy lives in city S, which consists of n districts. There are n - 1 bidire…
题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=5308 题面: I Wanna Become A 24-Point Master Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 602    Accepted Submission(s): 249 Special Judge Proble…
QSC and Master Problem Description   Every school has some legends, Northeastern University is the same. Enter from the north gate of Northeastern University,You are facing the main building of Northeastern University.Ninety-nine percent of the stude…
Problem Description Master Mind KongMing gave Fei Zhang a secrete master plan stashed × matrix, but Fei didn't know the correct direction to hold the sheet. What a pity! Given two secrete master plans. The first one is the master's original plan. The…