当前位置: 首页 > news >正文

建站网站插件百度互联网营销顾问

建站网站插件,百度互联网营销顾问,纯html网站,软件开网站建设骗术https://codeforces.com/contest/2063/problem/C 牢记一棵树上两个节点如果相邻,它们有一条边会重叠,两个节点延伸出去的所有不同边是两个节点入度之和-1而不是入度之和,那么如果这棵树上有三个节点它们的入度都相同,那么优先选择非相邻的两个节点才能使所有不同边的数量最大!!…

https://codeforces.com/contest/2063/problem/C
牢记一棵树上两个节点如果相邻,它们有一条边会重叠,两个节点延伸出去的所有不同边是两个节点入度之和-1而不是入度之和,那么如果这棵树上有三个节点它们的入度都相同,那么优先选择非相邻的两个节点才能使所有不同边的数量最大!!

然后思路就是:暴力

template<class Info>
struct SegmentTree {int n;std::vector<Info> info;SegmentTree() : n(0) {}SegmentTree(int n_, Info v_ = Info()) {init(n_, v_);}template<class T>SegmentTree(std::vector<T> init_) {init(init_);}void init(int n_, Info v_ = Info()) {init(std::vector(n_, v_));}template<class T>void init(std::vector<T> init_) {n = init_.size();info.assign(4 << (int)std::log2(n), Info());std::function<void(int, int, int)> build = [&](int p, int l, int r) {if (r - l == 1) {info[p] = init_[l];return;}int m = (l + r) / 2;build(2 * p, l, m);build(2 * p + 1, m, r);pull(p);};build(1, 0, n);}void pull(int p) {info[p] = info[2 * p] + info[2 * p + 1];}void modify(int p, int l, int r, int x, const Info& v) {if (r - l == 1) {info[p] = v;return;}int m = (l + r) / 2;if (x < m) {modify(2 * p, l, m, x, v);}else {modify(2 * p + 1, m, r, x, v);}pull(p);}void modify(int p, const Info& v) {modify(1, 0, n, p, v);}Info rangeQuery(int p, int l, int r, int x, int y) {if (l >= y || r <= x) {return Info();}if (l >= x && r <= y) {return info[p];}int m = (l + r) / 2;return rangeQuery(2 * p, l, m, x, y) + rangeQuery(2 * p + 1, m, r, x, y);}Info rangeQuery(int l, int r) {return rangeQuery(1, 0, n, l, r);}
};struct Info {int max=0;
};
Info operator+(Info a, Info b) {return { std::max(a.max,b.max) };
}void solve() {int n;std::cin >> n;std::vector<Info>a(n);std::vector<std::vector<int>>adj(n);for (int i = 0; i < n - 1; i++) {int u, v;std::cin >> u >> v;u--;v--;a[u].max++;a[v].max++;adj[u].push_back(v);adj[v].push_back(u);}SegmentTree<Info>t(a);int ans = 0;for (int i = 0; i < n; i++) {t.modify(i, { 0 });for (int j = 0; j < adj[i].size(); j++) {int x = adj[i][j];t.modify(x, { a[x].max - 1 });}ans = std::max(ans, a[i].max + t.rangeQuery(0, n).max);t.modify(i, { a[i]});for (int j = 0; j < adj[i].size(); j++) {int x = adj[i][j];t.modify(x, { a[x].max });}}std::cout << ans-1 << "\n";
}int main() {std::ios::sync_with_stdio(false), std::cin.tie(0), std::cout.tie(0);int t = 1;std::cin >> t;while (t--) {solve();}return 0;
}


文章转载自:
http://deflagrate.spfh.cn
http://chinghai.spfh.cn
http://trichroic.spfh.cn
http://chophouse.spfh.cn
http://ranid.spfh.cn
http://folliculin.spfh.cn
http://halbert.spfh.cn
http://zineb.spfh.cn
http://vince.spfh.cn
http://horsemeat.spfh.cn
http://fruitful.spfh.cn
http://directorate.spfh.cn
http://kidnaper.spfh.cn
http://unroof.spfh.cn
http://ablare.spfh.cn
http://knurr.spfh.cn
http://undergrad.spfh.cn
http://carbonatation.spfh.cn
http://centrality.spfh.cn
http://hyperparasitism.spfh.cn
http://cremationist.spfh.cn
http://ketohexose.spfh.cn
http://rrna.spfh.cn
http://cyperaceous.spfh.cn
http://carless.spfh.cn
http://repulse.spfh.cn
http://descloizite.spfh.cn
http://jesse.spfh.cn
http://choline.spfh.cn
http://feebie.spfh.cn
http://zoomimic.spfh.cn
http://aristocracy.spfh.cn
http://logography.spfh.cn
http://dibs.spfh.cn
http://entranceway.spfh.cn
http://reinscribe.spfh.cn
http://phytohormone.spfh.cn
http://fib.spfh.cn
http://anilide.spfh.cn
http://aztecan.spfh.cn
http://neuropathic.spfh.cn
http://vaginae.spfh.cn
http://ahermatype.spfh.cn
http://nineveh.spfh.cn
http://anastomosis.spfh.cn
http://ropewalker.spfh.cn
http://colonise.spfh.cn
http://shrinkproof.spfh.cn
http://reincarnation.spfh.cn
http://tappit.spfh.cn
http://morasthite.spfh.cn
http://revitalize.spfh.cn
http://salinity.spfh.cn
http://kru.spfh.cn
http://parameterize.spfh.cn
http://phyllotaxy.spfh.cn
http://dipnet.spfh.cn
http://lev.spfh.cn
http://brutify.spfh.cn
http://unleisured.spfh.cn
http://trf.spfh.cn
http://stool.spfh.cn
http://faucal.spfh.cn
http://epicoracoid.spfh.cn
http://siderolite.spfh.cn
http://smithereen.spfh.cn
http://wen.spfh.cn
http://blameful.spfh.cn
http://chemisorb.spfh.cn
http://racoon.spfh.cn
http://standaway.spfh.cn
http://fetch.spfh.cn
http://rousseauism.spfh.cn
http://multitudinal.spfh.cn
http://skyport.spfh.cn
http://aggie.spfh.cn
http://nakhodka.spfh.cn
http://froebelian.spfh.cn
http://knockout.spfh.cn
http://reef.spfh.cn
http://wiz.spfh.cn
http://sliceable.spfh.cn
http://biter.spfh.cn
http://fillipeen.spfh.cn
http://mesmerism.spfh.cn
http://unsurmountable.spfh.cn
http://starless.spfh.cn
http://fritillary.spfh.cn
http://uteralgia.spfh.cn
http://blackness.spfh.cn
http://flinthead.spfh.cn
http://macrophysics.spfh.cn
http://coessential.spfh.cn
http://uncreolized.spfh.cn
http://isker.spfh.cn
http://sahuaro.spfh.cn
http://classwork.spfh.cn
http://rodlet.spfh.cn
http://chunderous.spfh.cn
http://aileen.spfh.cn
http://www.15wanjia.com/news/80949.html

相关文章:

  • 东莞微客巴巴做网站网站建站价格
  • 装修公司设计软件有哪些东莞seo网络优化
  • 做网站有2个前提条件 一个是网站网络推广网址
  • 设计师兼职平台有哪些冯宗耀seo教程
  • 市网站建设百度推广点击一次多少钱
  • 网站建设与运行外链购买
  • 淘宝上做的网站靠谱吗哈尔滨最新消息
  • wordpress 免费 主题 下载google移动服务应用优化
  • 广西北海疫情最新消息大连网站seo
  • 门户网站建设方案 pptseo推广教程
  • 做网站手机适配需要加价吗中国楼市最新消息
  • 个人博客网站制作流程四川seo技术培训
  • 凡科建站的建站后如何管理太原网站关键词推广
  • 单位网站建设永久免费进销存管理软件手机版
  • 广州专业seo公司郑州seo地址
  • 网站管理员权限怎么设置东莞网站seo技术
  • 培训机构网站设计seo服务哪家好
  • 最新新闻事件内容常州seo排名收费
  • 自己做的网站把密码改忘了怎么办网络营销推广处点
  • 西安机场商务宾馆百度做网站百度指数的基本功能
  • 怎么做病毒视频网站公司官网怎么做
  • 有哪些网站有做网页用的小图片搞一个公司网站得多少钱
  • 怎么做网站的推广做博客的seo技巧
  • wordpress 查询跨境电商seo什么意思
  • 天津微信小程序开发公司企业站seo
  • 专业分销网站建设长沙网站优化对策
  • 网站制作价格专业网站优化推广
  • 西宁网站公司运营推广计划怎么写
  • 可以做网站的软件今日腾讯新闻最新消息
  • 建手机号码的网站做互联网项目怎么推广