// Problem: #10098. 「一本通 3.6 例 1」分离的路径 // Contest: LibreOJ // URL: https://loj.ac/p/10098 // Memory Limit: 64 MB // Time Limit: 1000 ms // // Powered by CP Editor (https://cpeditor.org)
#include<bits/stdc++.h> using namespace std; #define int long long inline int read(){int x=0,f=1;char ch=getchar(); while(ch<'0'||ch>'9'){if(ch=='-')f=-1; ch=getchar();}while(ch>='0'&&ch<='9'){x=(x<<1)+ (x<<3)+(ch^48);ch=getchar();}return x*f;} #define M 10010 //#define mo #define N 5010 struct node { int x, y, n; }d[M*2]; int n, m, i, j, k; int h[N], f[N], c[N], dep[N], rd[N]; int lf, u, v;
// Problem: P3225 [HNOI2012]矿场搭建 // Contest: Luogu // URL: https://www.luogu.com.cn/problem/P3225 // Memory Limit: 125 MB // Time Limit: 1000 ms // // Powered by CP Editor (https://cpeditor.org)
#include<bits/stdc++.h> using namespace std; #define int long long inline int read(){int x=0,f=1;char ch=getchar(); while(ch<'0'||ch>'9'){if(ch=='-')f=-1; ch=getchar();}while(ch>='0'&&ch<='9'){x=(x<<1)+ (x<<3)+(ch^48);ch=getchar();}return x*f;} //#define mo #define M 510 #define N 1010 struct node { int x, y, n; }d[M*2]; int n, m, i, j, k, T; int h[N], dep[N], c[N], w[N], f[N], zi[N]; int u, v, ansx, ansy, a, b;
// Problem: #10100. 「一本通 3.6 练习 1」网络 // Contest: LibreOJ // URL: https://loj.ac/p/10100 // Memory Limit: 10 MB // Time Limit: 1000 ms // // Powered by CP Editor (https://cpeditor.org)
#include<bits/stdc++.h> using namespace std; //#define int long long inline int read(){int x=0,f=1;char ch=getchar(); while(ch<'0'||ch>'9'){if(ch=='-')f=-1; ch=getchar();}while(ch>='0'&&ch<='9'){x=(x<<1)+ (x<<3)+(ch^48);ch=getchar();}return x*f;} //#define mo #define N 110 struct node { int x, y, n; }d[N*N*2]; int n, m, i, j, k; int x, y, z, ans; int h[N], c[N]; char ch;
// Problem: #10100. 「一本通 3.6 练习 1」网络 // Contest: LibreOJ // URL: https://loj.ac/p/10100 // Memory Limit: 10 MB // Time Limit: 1000 ms // // Powered by CP Editor (https://cpeditor.org)
#include<bits/stdc++.h> using namespace std; //#define int long long inline int read(){int x=0,f=1;char ch=getchar(); while(ch<'0'||ch>'9'){if(ch=='-')f=-1; ch=getchar();}while(ch>='0'&&ch<='9'){x=(x<<1)+ (x<<3)+(ch^48);ch=getchar();}return x*f;} //#define mo #define N 110 struct node { int x, y, n; }d[N*N*2]; int n, m, i, j, k; int x, y, z, ans; int h[N], c[N], f[N], zi[N]; char ch;
// Problem: P5058 [ZJOI2004]嗅探器 // Contest: Luogu // URL: https://www.luogu.com.cn/problem/P5058 // Memory Limit: 125 MB // Time Limit: 1000 ms // // Powered by CP Editor (https://cpeditor.org)
#include<bits/stdc++.h> using namespace std; #define int long long inline int read(){int x=0,f=1;char ch=getchar(); while(ch<'0'||ch>'9'){if(ch=='-')f=-1; ch=getchar();}while(ch>='0'&&ch<='9'){x=(x<<1)+ (x<<3)+(ch^48);ch=getchar();}return x*f;} #define M 500010 //#define mo #define N 200010 struct node { int x, y, n; }d[M*2]; int n, m, i, j, k; int dep[N], f[N], h[N], zi[N]; int u, v, ans, a, b;
// Problem: #10102. 「一本通 3.6 练习 3」旅游航道 // Contest: LibreOJ // URL: https://loj.ac/p/10102 // Memory Limit: 512 MB // Time Limit: 1000 ms // // Powered by CP Editor (https://cpeditor.org)
#include<bits/stdc++.h> using namespace std; #define int long long inline int read(){int x=0,f=1;char ch=getchar(); while(ch<'0'||ch>'9'){if(ch=='-')f=-1; ch=getchar();}while(ch>='0'&&ch<='9'){x=(x<<1)+ (x<<3)+(ch^48);ch=getchar();}return x*f;} //#define M //#define mo #define N 30010 struct node { int x, y, n; }d[N*2]; int n, m, i, j, k; int f[N], dep[N], h[N], c[N*2]; int u, v, ans;
int fa(int x) { if(f[x]==x) return x; return f[x]=fa(f[x]); }
// Problem: #10103. 「一本通 3.6 练习 4」电力 // Contest: LibreOJ // URL: https://loj.ac/p/10103 // Memory Limit: 64 MB // Time Limit: 5000 ms // // Powered by CP Editor (https://cpeditor.org)
#include<bits/stdc++.h> using namespace std; //#define int long long inline int read(){int x=0,f=1;char ch=getchar(); while(ch<'0'||ch>'9'){if(ch=='-')f=-1; ch=getchar();}while(ch>='0'&&ch<='9'){x=(x<<1)+ (x<<3)+(ch^48);ch=getchar();}return x*f;} //#define mo #define N 10010 struct node { int x, y, n; }d[N*200]; int n, m, i, j, k; int u, v, h[N], ans; int dep[N], zi[N], zao[N];