上一页 1 ··· 30 31 32 33 34 35 36 37 38 ··· 54 下一页
  2023年2月18日
摘要: https://www.liaoxuefeng.com/wiki/1016959663602400 阅读全文
posted @ 2023-02-18 17:23 towboat 阅读(9) 评论(0) 推荐(0)
摘要: A.对于欧拉路径: 有向图:图连通,有一个顶点出度大入度1,有一个顶点入度大出度1,其余都是出度 == 入度 无向图:图连通,只有两个顶点是奇数度,其余都是偶数度 B.对于欧拉回路: 有向图:图连通,所有的顶点出度 == 入度 无向图:图连通,所有顶点都是偶数度 阅读全文
posted @ 2023-02-18 15:09 towboat 阅读(19) 评论(0) 推荐(0)
  2023年2月17日
摘要: 看 某个点的入队次数 times>=n #include <bits/stdc++.h> using namespace std ; const int N=1e5+2,inf=0x7f7f3f; struct E{ int y,z; E(int y0,int z0){ y=y0,z=z0; } f 阅读全文
posted @ 2023-02-17 22:54 towboat 阅读(17) 评论(0) 推荐(0)
摘要: 本例 求树上两点的距离 #include <bits/stdc++.h> using namespace std ; const int N=5*1e6+2,M=5*N; int nxt[M],hd[N],all,go[M],n; int dep[N],f[N][22]; void add(int 阅读全文
posted @ 2023-02-17 14:03 towboat 阅读(28) 评论(0) 推荐(0)
  2023年2月16日
摘要: 在边权都为1的 树上加1条或者2条边(边权为1) ,从1出发遍历所有点,使得总路程最短 #include <bits/stdc++.h> using namespace std ; const int N=1e5+2,M=2*N; int nxt[M],w[M],go[M],hd[N],all=1; 阅读全文
posted @ 2023-02-16 21:33 towboat 阅读(18) 评论(0) 推荐(0)
摘要: struct Q{ int q[N],hh=1,tt=0; void push(int x){ q[++tt]=x; } void pop(){hh++;} bool empty(){return hh<=tt?0:1;} int front(){ return q[hh]; } }; 阅读全文
posted @ 2023-02-15 23:59 towboat 阅读(15) 评论(0) 推荐(0)
  2023年1月31日
摘要: n=0 N=10000 all=0 go=[0]*N hd=[0]*N nxt=[0]*N def add_(x,y): global all all+=1 nxt[all]=hd[int(x)] go[all]=y hd[x]=all def dfs(x): print("%d "%(x)) i= 阅读全文
posted @ 2023-01-31 12:54 towboat 阅读(12) 评论(0) 推荐(0)
  2023年1月26日
摘要: 求 [a,b] 中 与n 互素的数字个数 #include <iostream> #include <algorithm> using namespace std; const int N =200; #define int long long int tot,fac[N]; int hh,q[10 阅读全文
posted @ 2023-01-26 13:28 towboat 阅读(24) 评论(0) 推荐(0)
  2023年1月22日
摘要: int temp[N],a[N]; int main(){ int n; cin>>n; for(int i=1;i<=n;i++){ cin>>a[i]; temp[i]=a[i]; } sort(temp+1,temp+n+1); int len=unique(temp+1,temp+n+1)- 阅读全文
posted @ 2023-01-22 20:08 towboat 阅读(21) 评论(0) 推荐(0)
  2023年1月14日
摘要: inline int read(){ int s = 0, w = 1; char c = getchar(); for (; !isdigit(c); c = getchar()) if (c == '-') w = -1; for (; isdigit(c); c = getchar()) s 阅读全文
posted @ 2023-01-14 13:37 towboat 阅读(54) 评论(0) 推荐(0)
上一页 1 ··· 30 31 32 33 34 35 36 37 38 ··· 54 下一页