摘要: 今天产题解效率有点高啊 其实全是切的板子题 solve 显然,路径构成树 求两点距离,显然lca 然后就和Pasture Walking G 牧场散步 题解没啥区别了 然后就没有然后了 那个方向没有用,输入进来就不用管了 Code #include<bits/stdc++.h> using name 阅读全文
posted @ 2026-03-25 14:57 msjing 阅读(13) 评论(0) 推荐(0)
摘要: solve 貌似是LCA板子题 我甚至上来没看懂题在说什么 只需要在算dis(路径长)时加上w[i]就行了 Code #include<bits/stdc++.h> using namespace std; const int maxn=1000010; int n,m,s; int h[maxn] 阅读全文
posted @ 2026-03-25 14:43 msjing 阅读(7) 评论(0) 推荐(0)
摘要: #include<bits/stdc++.h> using namespace std; const int maxn=100010; int n,m; int f[maxn][20]; int Log[maxn]; void llog(){for (int i=2;i<=n;i++) Log[i] 阅读全文
posted @ 2026-03-24 12:18 msjing 阅读(12) 评论(0) 推荐(0)
摘要: 把题目烤批过来qwq U234960 山海经 题目背景 “南山经之首,曰鹊山。其首曰招摇之山,临于西海之上,多桂,多金玉。 有草焉,其状如韭而青华,其名日祝余,食之不饥…… 又东三百里,曰堂庭之山,多棪木,多白猿,多水玉,多黄金。 又东三百八十里,曰猿翼之山,其中多怪兽,水多怪鱼,多白玉,多蝮虫,多 阅读全文
posted @ 2026-03-24 12:12 msjing 阅读(9) 评论(0) 推荐(0)
摘要: inline void read(int &x) { char ch=getchar();int f=1;x=0; while(!isdigit(ch) && ch^'-') ch=getchar(); if(ch=='-') f=-1,ch=getchar(); while(isdigit(ch) 阅读全文
posted @ 2026-03-24 12:11 msjing 阅读(6) 评论(0) 推荐(0)
摘要: 单点修改,区间查询Code int lowbit(int x) {return (x&(-x));} void add(int w,int x) { while(w<=n) { c[w]+=x; w+=lowbit(w); } } int getsum(int w) { int res=0; whi 阅读全文
posted @ 2026-03-24 11:54 msjing 阅读(11) 评论(0) 推荐(0)
摘要: 倍增法 #include<bits/stdc++.h> using namespace std; const int maxn=1000010; int n,m,s; int h[maxn],nxt[maxn],to[maxn],tot; int Log[maxn]; int dep[maxn]; 阅读全文
posted @ 2026-03-24 11:50 msjing 阅读(4) 评论(0) 推荐(0)
摘要: dijkstra #include<bits/stdc++.h> using namespace std; const int maxn=1e5+10; int n,m,k; int h[maxn],nxt[maxn],to[maxn],w[maxn],tot; int dis[maxn][30]; 阅读全文
posted @ 2026-03-24 11:49 msjing 阅读(5) 评论(0) 推荐(0)
摘要: Code1 int ksm(int a,int b,int p) { int x=1; a%=p; while (b) { b>>=1; a=a*a%p; if (b&1) x=x*a%p; } return x; } Code2 蒙哥马利快速幂 long long mgml(long long a 阅读全文
posted @ 2026-03-24 11:49 msjing 阅读(8) 评论(0) 推荐(0)
摘要: #include<bits/stdc++.h> using namespace std; int n,m,r,c,x,y; const int maxn=2000+10; int g[maxn][maxn]; bool vis[maxn][maxn]; int ans; int idx[6]={0, 阅读全文
posted @ 2026-03-24 11:48 msjing 阅读(5) 评论(0) 推荐(0)