上一页 1 ··· 4 5 6 7 8 9 10 11 12 13 下一页
摘要: $\text{Solution}$ 一道简单的$tarjan$求割点,只需判断$B$点是否在子树内即可。 $\text{Code}$ #include<cstdio> #include<algorithm> #define RE register #define IN inline using na 阅读全文
posted @ 2022-01-24 16:12 RiverSheep 阅读(47) 评论(0) 推荐(0)
摘要: #include<cstdio> #include<cstring> #include<algorithm> using namespace std; int t,S,T,n,a[55],b[55],cur[105],tot,h[105],dep[105],q[110]; struct edge{ 阅读全文
posted @ 2022-01-24 16:11 RiverSheep 阅读(26) 评论(0) 推荐(0)
摘要: #include<cstdio> #include<cstring> #include<algorithm> using namespace std; int tot,n,t,dep[600],q[600],cur[600],h[600],S,T; struct edge{ int to,nxt,z 阅读全文
posted @ 2022-01-24 16:10 RiverSheep 阅读(48) 评论(0) 推荐(0)
摘要: #include<cstdio> #include<cstring> #include<algorithm> using namespace std; int h[705],cur[705],n,m,dep[705],q[705],tot = 1,S,T; struct edge{ int to,n 阅读全文
posted @ 2022-01-24 16:09 RiverSheep 阅读(31) 评论(0) 推荐(0)
摘要: #include<cstdio> #include<algorithm> using namespace std; int a[5005],f[5005][5005],n,vis[5005][5005]; double slope(int x,int y) {return (a[x] - a[y]) 阅读全文
posted @ 2022-01-24 16:09 RiverSheep 阅读(38) 评论(0) 推荐(0)
摘要: \(Solution\) 考虑$1$和$2$相邻是必须要长度为$1$的篱笆,所以只需考虑$1,2$和$0$之间要不要放篱笆,用$S$连向所有的$1$,所有的$2$连向$T$,现在问题是要使$S$与$T$不连通,这不是经典的最小割问题吗? \(Code\) #include<cstdio> #incl 阅读全文
posted @ 2022-01-24 16:08 RiverSheep 阅读(44) 评论(0) 推荐(0)
摘要: #include<cstdio> using namespace std; const int N = 1e5 + 5; int n,m,rt[N],sum[N << 5],ls[N << 5],rs[N << 5],size; void update(int &p1,int p2,int l,in 阅读全文
posted @ 2022-01-24 16:05 RiverSheep 阅读(46) 评论(0) 推荐(0)
摘要: #include<cstdio> #define LL long long using namespace std; int n,a[100005]; LL ans = 0; int main() { scanf("%d",&n); for (int i = 1; i <= n; i++) scan 阅读全文
posted @ 2022-01-24 16:05 RiverSheep 阅读(42) 评论(0) 推荐(0)
摘要: \(Solution\) 一个较为模板的最小割,对于第二问,把图的流量变为$1$,再跑一边网络流即可 \(Code\) #include<cstdio> #include<cstring> #include<algorithm> using namespace std; int h[50],cur[ 阅读全文
posted @ 2022-01-23 15:03 RiverSheep 阅读(71) 评论(0) 推荐(0)
摘要: $Solution$ 把木板看成一个点,把 $$ 看成一条边,因为一个 $$ 最多对应两块木板,现在问题转化成了二分图上的最小点覆盖问题,众所周知二分图上最小点覆盖等于最大匹配 $Code$ #include<cstdio> #include<cstring> #include<algorithm> 阅读全文
posted @ 2022-01-23 14:50 RiverSheep 阅读(62) 评论(0) 推荐(0)
上一页 1 ··· 4 5 6 7 8 9 10 11 12 13 下一页