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

worldpress 建站小程序开发平台免费

worldpress 建站,小程序开发平台免费,上海网站建设收费标准,商用自适应网站建设CF938G Shortest Path Queries Solution 套路题。 xorxorxor最短路可以用线性基维护#xff08;把每个环的边权异或和放进线性基#xff0c;询问时把树边路径边权异或和放在线性基里跑出最小值即可#xff09;。 然后因为线性基删除比较慢而麻烦#xff08;注意线性基是…CF938G Shortest Path Queries Solution 套路题。 xorxorxor最短路可以用线性基维护把每个环的边权异或和放进线性基询问时把树边路径边权异或和放在线性基里跑出最小值即可。 然后因为线性基删除比较慢而麻烦注意线性基是有办法动态加删元素的因此动态加删边可以用线段树分治可撤销带权并查集实现。 时间复杂度O(nlg2n)O(nlg^2n)O(nlg2n)。 Code最近顺便改了改码风 #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 T inline bool upmin(T x, T y) { return y x ? x y, 1 : 0; } templatetypename T inline bool upmax(T x, T y) { return x y ? x y, 1 : 0; }typedef long long ll; typedef unsigned long long ull; typedef long double lod; typedef pairint, int PR; typedef vectorint VI;const lod eps 1e-11; const lod pi acos(-1); const int oo 1 30; const ll loo 1ll 62; const int mods 998244353; const int MAXN 1000005; const int INF 0x3f3f3f3f;//1061109567 /*--------------------------------------------------------------------*/ inline int read() {int f 1, x 0; char c getchar();while (c 0 || c 9) { if (c -) f -1; c getchar(); }while (c 0 c 9) { x (x 3) (x 1) (c ^ 48); c getchar(); }return x * f; } mapPR, PR Map; int n, m, base[30], btop 0, bstk[MAXN], f[MAXN], num[MAXN], d[MAXN], Ans[MAXN], utop 0; struct ustknode{ int u, v, c; } ustk[MAXN]; struct Cnode{ int x, y, c; }; struct Qnode{ int id, x, y; }; vectorCnode C[MAXN]; vectorQnode Q[MAXN]; void insert(int x) {for (int i 29; i 0; -- i)if ((x i) 1) {if (!base[i]) { base[i] x, bstk[btop] i; return; }x ^ base[i];} } int getmn(int x) {for (int i 29; i 0; -- i) upmin(x, x ^ base[i]);return x; } int find(int x) { return f[x] x ? f[x] : find(f[x]); } int getdis(int x) { return f[x] x ? d[x] : getdis(f[x]) ^ d[x]; } void unions(int u, int v, int c) {if (num[u] num[v]) swap(u, v);ustk[utop] (ustknode){u, v, c}, f[v] u, d[v] ^ c, num[u] num[v]; } void update(int x, int l, int r, int L, int R, Cnode y) {if (l L r R) { C[x].PB(y); return; }int mid (l r) 1;if (R mid) update(x 1, l, mid, L, R, y);else if (L mid) update(x 1 | 1, mid 1, r, L, R, y);else update(x 1, l, mid, L, mid, y), update(x 1 | 1, mid 1, r, mid 1, R, y); } void solve(int x, int l, int r) {int blst btop, ulst utop;for (auto t:C[x]) {int u t.x, v t.y, c t.c, uu find(u), vv find(v);if (uu vv) insert(getdis(u) ^ getdis(v) ^ c);else unions(uu, vv, getdis(u) ^ getdis(v) ^ c); }if (l r) {for (auto t:Q[l]) Ans[t.id] getmn(getdis(t.x) ^ getdis(t.y));}else {int mid (l r) 1;solve(x 1, l, mid);solve(x 1 | 1, mid 1, r);}while (btop blst) base[bstk[btop --]] 0;while (utop ulst) num[ustk[utop].u] - num[ustk[utop].v], f[ustk[utop].v] ustk[utop].v, d[ustk[utop].v] ^ ustk[utop].c, -- utop; } signed main() {n read(), m read();for (int i 1; i n ; i) num[i] 1, f[i] i;for (int i 1; i m ; i) {int u read(), v read(), c read();Map[MP(u, v)] MP(0, c);}int Case read(), num 0;for (int i 1; i Case ; i) {int opt read(), x read(), y read(), c;if (opt 1) c read(), Map[MP(x, y)] MP(i, c);if (opt 2) update(1, 0, m, Map[MP(x, y)].fi, i, (Cnode){x, y, Map[MP(x,y)].se}), Map.erase(MP(x, y));if (opt 3) Q[i].PB(((Qnode){ num, x, y} ));}for (auto t : Map) update(1, 0, m, t.se.fi, m, (Cnode){t.fi.fi, t.fi.se, t.se.se});solve(1, 0, m);for (int i 1; i num; i) printf(%d\n, Ans[i]);return 0; }
http://www.zqtcl.cn/news/869283/

相关文章:

  • 阳光家园广州网站网站公司怎么做的好
  • wordpress网站音乐放不全阳山做网站
  • 橙色企业网站源码网站下载软件
  • 满足客户的分销管理系统seo搜索引擎优化技术教程
  • 链接网站制作住房建设部官方网站专家注册
  • 北京保障性住房建设投资中心网站以网络营销为主题的论文
  • 数字火币交易网站开发网站建设设计图图片
  • 惠民建设局网站东莞公司建设网站
  • 网站建设与维护教学课件煤炭网站建设规划书
  • 北京建设网站有哪些公司黄陌陌网站怎么做
  • 视频网页制作教程网站优化防范
  • 做优化网站注意什么开发者模式开着好不好
  • 网站顾客评价网站中怎么做网站统计
  • 网站建设安全措施表白网站是怎么做的
  • 一个服务器可以做几个网站百度北京公司地址全部
  • 武侯区网站建设哪里好点个人社保缴费比例是多少
  • 创建属于自己的网站定制应用软件有哪些
  • 网站建设类岗位建设工程施工合同示范文本2023最新版
  • 建站设计公司wordpress 跨域 cros
  • 做网站的公司哪好工程设计东莞网站建设技术支持
  • 虹口网站开发开发公司设计管理部绩效考核
  • 网站改版升级通知国外服务器公司有哪些
  • 做网站的s标的软件深圳网站建设 湖南岚鸿
  • 设计网站建设的合同书公司装修合同范本
  • 门户网站的好处企业邮箱系统
  • 重庆企业建站公司有那些网站做结伴旅游的
  • 创意营销策划案例网站网页制作及优化
  • 网站上动画视频怎么做的建设兵团12师教育局网站
  • 博客网站开发思维导图app网站制作公司
  • 池州网站建设有哪些公司兴义网站seo