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

韩国美容网站 模板wordpress中英文

韩国美容网站 模板,wordpress中英文,基于PHP的家教网站开发环境,室内装饰设计费收费标准AGC023F - 01 on Tree 题目描述 Solution 有一个奇妙的贪心思路。#xff08;奇妙的原因是我不会证#xff09; 这一题的结点需要按拓扑序排序#xff0c;并让逆序对个数最小。 考虑在儿子向父亲合并的过程中统计答案#xff0c;产生的逆序对个数就是cnt[father][1]∗cn…AGC023F - 01 on Tree 题目描述 Solution 有一个奇妙的贪心思路。奇妙的原因是我不会证 这一题的结点需要按拓扑序排序并让逆序对个数最小。 考虑在儿子向父亲合并的过程中统计答案产生的逆序对个数就是cnt[father][1]∗cnt[son][0]cnt[father][1]*cnt[son][0]cnt[father][1]∗cnt[son][0]其中cnt[x][0/1]cnt[x][0/1]cnt[x][0/1]表示xxx这个联通块已经拥有的0/10/10/1结点的数量我们贪心地选取cnt[x][0]cnt[x][1]\frac{cnt[x][0]}{cnt[x][1]}cnt[x][1]cnt[x][0]​最小的结点合并到父亲并堆维护这一过程就可以做到O(nlgn)O(nlgn)O(nlgn)求解答案。 #include vector #include list #include map #include set #include deque #include queue #include stack #include bitset #include algorithm #include functional #include numeric #include utility #include sstream #include iostream #include iomanip #include cstdio #include cmath #include cstdlib #include cctype #include string #include cstring #include ctime #include cassert #include string.h //#include unordered_set //#include unordered_map //#include bits/stdc.h#define MP(A,B) make_pair(A,B) #define PB(A) push_back(A) #define SIZE(A) ((int)A.size()) #define LEN(A) ((int)A.length()) #define FOR(i,a,b) for(int i(a);i(b);i) #define fi first #define se secondusing namespace std;templatetypename Tinline bool upmin(T x,T y) { return yx?xy,1:0; } templatetypename Tinline bool upmax(T x,T y) { return xy?xy,1:0; }typedef long long ll; typedef unsigned long long ull; typedef long double lod; typedef pairint,int PR; typedef vectorint VI;const lod eps1e-11; const lod piacos(-1); const int oo130; const ll loo1ll62; const int mods998244353; const int MAXN600005; const int INF0x3f3f3f3f;//1061109567 /*--------------------------------------------------------------------*/ inline int read() {int f1,x0; char cgetchar();while (c0||c9) { if (c-) f-1; cgetchar(); }while (c0c9) { x(x3)(x1)(c^48); cgetchar(); }return x*f; } int cnt[MAXN][2],fa[MAXN],f[MAXN]; struct heapnode {int x,y,id;bool operator (const heapnode a) const { return 1ll*x*a.y1ll*y*a.x; } }; priority_queueheapnode heap; int find(int x){ return f[x]x?f[x]:f[x]find(f[x]); } int main() {int nread();for (int i2;in;i) fa[i]read();for (int i1;in;i) {int xread();cnt[i][x];f[i]i;}for (int i2;in;i) heap.push((heapnode){cnt[i][0],cnt[i][1],i});ll ans0;while (!heap.empty()){int ufind(heap.top().id),xheap.top().x,yheap.top().y; heap.pop();if (cnt[u][0]xcnt[u][1]y){int vfind(fa[u]);ans1ll*cnt[v][1]*cnt[u][0];cnt[v][0]cnt[u][0];cnt[v][1]cnt[u][1];f[u]v;if (v!1) heap.push((heapnode){cnt[v][0],cnt[v][1],v});}}printf(%lld\n,ans);return 0; }
http://www.pierceye.com/news/709061/

相关文章:

  • 网站图片展示代码怎样给响应式网站提速
  • 学校 网站建设 招标广而告之微信推广平台
  • 企业如何通过地方网站宣传网站中国建设银行招聘官网
  • 上海品牌网站建设公网站的开发与建设项目
  • 做网站的艰辛电子商务网站建设与维护概述
  • 织梦网站做关键词网站开发到上线的过程
  • 威海千淼网站建设北京知名广告公司有哪些
  • wordpress多站点可视化wordpress主题flarum
  • 网站免费虚拟主机申请成华区微信网站建设公
  • 机械制造设备类企业网站织梦模板网站模板 博客
  • js跳转网站怎么做网络营销方式单一的原因
  • 做网站的职责做章的网站
  • 万网建设网站wordpress的ftp設置
  • 网站建设a云世家宋南南电子商务网站的开发方式
  • 水利工程建设监理网站美食网站建设总结
  • 中化建工北京建设投资有限公司网站南沙网站建设方案
  • 东莞网站制作网站死链是什么
  • 网站开发哪种语言更安全seopc流量排名官网
  • 中国站长之家域名查询深圳html5网站推广价格
  • 商业网站建设案例视频上海猎头公司哪家好
  • 如何开个人网站seo诊断站长
  • wordpress rss 订阅乐陵seo推广
  • 公司做一个网站企业建设3D网站
  • 自己做的网站别人打不开网络系统建设与运维职业技能等级证书
  • 签名能留链接的网站数据库网站建设公司
  • 网站权重不够高 导致创建网站销售产品
  • 中国建设报网站做网站如何文字链接文字
  • 网站建设网站多少钱网站上做值机的app
  • 百度手机网站提交做网站优化的教程
  • wordpress建站教程贴吧网站建设的论文的参考文献