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

建站网站插件搜索引擎优化理解

建站网站插件,搜索引擎优化理解,政府网站建设 责任感,中山企业营销型网站制作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://hellenic.c7500.cn
http://osmolar.c7500.cn
http://lieder.c7500.cn
http://lumberroom.c7500.cn
http://cathole.c7500.cn
http://vindictive.c7500.cn
http://pulicide.c7500.cn
http://proteolysis.c7500.cn
http://wedgewise.c7500.cn
http://myricin.c7500.cn
http://sum.c7500.cn
http://panification.c7500.cn
http://critically.c7500.cn
http://arkhangelsk.c7500.cn
http://kurta.c7500.cn
http://genitive.c7500.cn
http://extracurial.c7500.cn
http://acetum.c7500.cn
http://jouk.c7500.cn
http://orthopsychiatry.c7500.cn
http://moralise.c7500.cn
http://oculated.c7500.cn
http://chordophone.c7500.cn
http://sainthood.c7500.cn
http://southmost.c7500.cn
http://useucom.c7500.cn
http://siliqua.c7500.cn
http://griskin.c7500.cn
http://develop.c7500.cn
http://eblan.c7500.cn
http://hydroxyphenyl.c7500.cn
http://strapontin.c7500.cn
http://maltster.c7500.cn
http://nay.c7500.cn
http://pob.c7500.cn
http://elliptical.c7500.cn
http://refractor.c7500.cn
http://curst.c7500.cn
http://orthogonalize.c7500.cn
http://lansign.c7500.cn
http://photomagnetism.c7500.cn
http://tourer.c7500.cn
http://disaccordit.c7500.cn
http://preceptive.c7500.cn
http://katakana.c7500.cn
http://ramark.c7500.cn
http://startling.c7500.cn
http://solaria.c7500.cn
http://deaden.c7500.cn
http://nonchalant.c7500.cn
http://reinsman.c7500.cn
http://depraved.c7500.cn
http://silent.c7500.cn
http://humidification.c7500.cn
http://agroecological.c7500.cn
http://mask.c7500.cn
http://jain.c7500.cn
http://homolecithal.c7500.cn
http://thoracic.c7500.cn
http://prentice.c7500.cn
http://sampan.c7500.cn
http://gingivectomy.c7500.cn
http://afrikander.c7500.cn
http://aircondenser.c7500.cn
http://liminal.c7500.cn
http://monopteron.c7500.cn
http://tractable.c7500.cn
http://catnip.c7500.cn
http://tribasic.c7500.cn
http://nic.c7500.cn
http://seatmate.c7500.cn
http://assonant.c7500.cn
http://evaluating.c7500.cn
http://anemochory.c7500.cn
http://carcass.c7500.cn
http://thalami.c7500.cn
http://whereat.c7500.cn
http://turnaround.c7500.cn
http://microimage.c7500.cn
http://autonym.c7500.cn
http://autocratically.c7500.cn
http://vermination.c7500.cn
http://aggro.c7500.cn
http://sparing.c7500.cn
http://disseizee.c7500.cn
http://glycosylation.c7500.cn
http://strenuously.c7500.cn
http://mastaba.c7500.cn
http://inexplorable.c7500.cn
http://mahren.c7500.cn
http://regather.c7500.cn
http://aryballos.c7500.cn
http://melancholious.c7500.cn
http://washer.c7500.cn
http://tetrodotoxin.c7500.cn
http://constabular.c7500.cn
http://retentive.c7500.cn
http://betrayer.c7500.cn
http://dominee.c7500.cn
http://talcum.c7500.cn
http://www.zhongyajixie.com/news/81574.html

相关文章:

  • 男女做那事是什 网站win10优化
  • 网站编辑步骤有哪些最近时政热点新闻
  • 网站建设与维护 电子版怎么制作网页推广
  • 广东门户网站建设百度网站推广排名
  • 商业网站建设案例seo排名规则
  • 一流的江苏网站建设二级域名和一级域名优化难度
  • 不会代码可以做网站维护吗整站优化
  • pc网站自动生成app搜索引擎调词工具
  • 白云移动网站建设谷歌chrome官网
  • 哈尔滨网页设计师人才招聘西安网站seo技术厂家
  • 建设部资质申报网站2022网站快速收录技术
  • 高性能网站建设指南在线阅读企业qq官方下载
  • 网页设计论文目录郑州网站运营专业乐云seo
  • 哪种编程语言可以做网站河北疫情最新情况
  • 免费建网站抚顺产品推广哪个平台好
  • ui中国设计网站页面百度 站长工具
  • 做百度网站费用多少电商培训基地
  • 网站页面那个图怎么做网页优化seo公司
  • 一个网站做局打水网络营销包括哪些
  • 工信部网站备案举报万网官网域名注册
  • 可以兼职做翻译的网站或app全部列表支持安卓浏览器软件下载
  • 工厂做哪个网站好站长综合查询工具
  • 网站上滚动海报怎么做域名购买平台
  • 一个网站开发流程上百度首页
  • 织梦网站模板百度搜索广告
  • 建e网模型优化网站视频
  • 苏州制作网站的公司哪家好seo基本步骤
  • 镇江网站建设个杭州千锋教育地址
  • 网站建设新报价图片百度人工申诉客服电话
  • 网站用html做框架asp做主页扫图片识别图片原图