【开源社区openEuler实践】 F. Microcycle

题目

【坑点】:不能先用拓扑排序去掉“线头”,然后找权重最小的边所在的环。因为去掉线头后,可能有的边不在环内。

e.g.有六条无向边 1 - 2 , 2 - 3, 1 - 3, 4 - 5, 5 - 6, 4 - 6, 1 - 4,  边1 - 4不在环内

wa代码:

#include <bits/stdc++.h>
using namespace std;
#define int long long
#define pb push_back
#define fi first
#define se second
#define lson p << 1
#define rson p << 1 | 1
#define ll long long
#define pii pair<int, int>
#define ld long double
const int maxn = 1e6 + 5, inf = 1e9, maxm = 4e4 + 5, base = 37;
const int N = 1e5 + 5;
const int mod = 1e9 + 7;
// const int mod = 998244353;
// const __int128 mod = 212370440130137957LL;
int n, m;

struct DSU{
	int n;
	vector<int> fa, siz;
	DSU(int n) : n(n + 1), fa(n + 1), siz(n + 1, 1){
		iota(fa.begin(), fa.end(), 0);
	}
	int find(int x){
		if(x == fa[x]) return x;
		return fa[x] = find(fa[x]);
	}
	bool merge(int x, int y){
		x = find(x), y = find(y);
		if(x == y) return 0;
		fa[x] = y;
		return 1;
	}
};
//long long ? maxn ? n? m?
void solve(){
    ll res = 0;
    int k;
    cin >> n >> m;
	// vector<int> a(n + 1);
	// for(int i = 1; i <= n; i++){
	// 	cin >> a[i];
	// }
	vector<vector<pii>> G(n + 1);
	vector<array<int, 3>> edge;
	vector<int> vis(n + 1), ind(n + 1);
	map<pii, bool> mp;
	for(int i = 1; i <= m; i++){
		int u, v, w;
		cin >> u >> v >> w;
		G[u].pb({v, w});
		G[v].pb({u, w});
		// edge.pb({u, v, w});
		if(u > v) swap(u, v);
		if(mp.count({u, v})) continue;
		mp[{u, v}] = 1;
		ind[u]++, ind[v]++;
	}
	queue<int> q;
	for(int i = 1; i <= n; i++){
		if(ind[i] <= 1){
			q.push(i);
			vis[i] = 1;
		}
	}
	while(!q.empty()){
		int u = q.front();
		q.pop();
		for(auto [v, w] : G[u]){
			if(--ind[v] <= 1 && !vis[v]){
				vis[v] = 1;
				q.push(v);
			}
		}
	}
	int from, to, mn = inf;
	for(int u = 1; u <= n; u++){
		if(vis[u]) continue;
		for(auto [v, w] : G[u]){
			if(vis[v]) continue;
			if(w < mn){
				mn = w;
				from = u;
				to = v;
			}
		}
	}
	bool ok = 0;
	vector<int> ans, path;
	auto dfs = [&](auto self, int u, int p) -> void {
		if(ok) return;
		if(u == to && p == from) return;
		if(vis[u]) return;
		vis[u] = 1;
		path.pb(u);
		// cout << u << '\n';
		// for(auto x : path){
		// 	cout << x << ' ';
		// }
		// cout << "\n\n";
		if(u == to){
			ans = path;
			ok = 1;
			return;
		}
		for(auto [v, w] : G[u]){
			// if(vis[v] || u == from && v == to) continue;
			// vis[v] = 1;
			if(v == p) continue;
			self(self, v, u);
		}
		path.pop_back();
	};
	// vis[from] = 1;
	dfs(dfs, from, to);
	cout << mn << ' ' << ans.size() << '\n';
	for(auto x : ans){
		cout << x << ' ';
	}
	if(ans.size() == 0){
		cout << from << ' ' << to;
	}
	cout << '\n';
	// int l = 1, r = inf;
	// auto check = [&](int x) -> bool {
	// 	DSU d(n);
	// 	for(auto [u, v, w] : edge){
	// 		if(w >= x){
	// 			if(!d.merge(u, v)){
	// 				return 1;
	// 			}
	// 		}
	// 	}
	// 	return 0;
	// };
	// while(l <= r){
	// 	int mid = (l + r) >> 1;
	// 	if(check(mid)) r = mid - 1;
	// 	else l = mid + 1;
	// }
	// DSU d(n);
	// for(auto [u, v, w] : edge){
	// 	if (w >= r){
	// 		if (!d.merge(u, v)){
				
	// 		}
	// 	}
	// }
}
    
signed main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout << fixed << setprecision(9);
    
    int T = 1;
    cin >> T;
    while (T--){
        solve();
    }
    return 0;
}

题解:

#include <bits/stdc++.h>
using namespace std;
#define int long long
#define pb push_back
#define fi first
#define se second
#define lson p << 1
#define rson p << 1 | 1
#define ll long long
#define pii pair<int, int>
#define ld long double
const int maxn = 1e6 + 5, inf = 1e9, maxm = 4e4 + 5, base = 37;
const int N = 1e5 + 5;
const int mod = 1e9 + 7;
// const int mod = 998244353;
// const __int128 mod = 212370440130137957LL;
int n, m;

struct DSU{
	int n;
	vector<int> fa, siz;
	DSU(int n) : n(n + 1), fa(n + 1), siz(n + 1, 1){
		iota(fa.begin(), fa.end(), 0);
	}
	int find(int x){
		if(x == fa[x]) return x;
		return fa[x] = find(fa[x]);
	}
	bool merge(int x, int y){
		x = find(x), y = find(y);
		if(x == y) return 0;
		fa[x] = y;
		return 1;
	}
};
//long long ? maxn ? n? m?
void solve(){
    ll res = 0;
    int k;
    cin >> n >> m;
	// vector<int> a(n + 1);
	// for(int i = 1; i <= n; i++){
	// 	cin >> a[i];
	// }
	vector<vector<pii>> G(n + 1);
	vector<array<int, 3>> edge;
	vector<int> vis(n + 1), ind(n + 1);
	for(int i = 1; i <= m; i++){
		int u, v, w;
		cin >> u >> v >> w;
		edge.pb({w, u, v});
	}
	sort(edge.begin(), edge.end(), greater<>());
	int from, to, mn = inf;
	DSU d(n);
	for(auto [w, u, v] : edge){
		if(!d.merge(u, v)){
			from = u;
			to = v;
			mn = w;
		}
		else{
			G[u].pb({v, w});
			G[v].pb({u, w});
		}
	}
	
	bool ok = 0;
	vector<int> ans, path;
	auto dfs = [&](auto self, int u, int p) -> void {
		if(ok) return;
		if(u == to && p == from) return;
		if(vis[u]) return;
		vis[u] = 1;
		path.pb(u);
		if(u == to){
			ans = path;
			ok = 1;
			return;
		}
		for(auto [v, w] : G[u]){
			// if(vis[v] || u == from && v == to) continue;
			// vis[v] = 1;
			if(v == p) continue;
			self(self, v, u);
		}
		path.pop_back();
	};
	// vis[from] = 1;
	dfs(dfs, from, to);
	cout << mn << ' ' << ans.size() << '\n';
	for(auto x : ans){
		cout << x << ' ';
	}
	cout << '\n';
}
    
signed main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout << fixed << setprecision(9);
    
    int T = 1;
    cin >> T;
    while (T--){
        solve();
    }
    return 0;
}

Rab GTPases serve as master regulators of membrane trafficking. They can be activated by guanine nucleotide exchange factors (GEF) and be inactivated by GTPase-activating proteins (GAPs). The roles of some GAPs have been explored in Saccharomyces cerevisiae, but are largely unknown in filamentous fungi. Here, we investigated the role of GAP Gyp3 gene, an ortholog of S. cerevisiae Gyp3, in an entomopathogenic fungus, Metarhizium acridum. We found that MaGyp3 is mainly localized to the endoplasmic reticulum (ER) of vegetative hyphae, nuclei of mature conidia, and both ER and nuclei in invasive hyphae. Lack of MaGyp3 caused a decreased tolerance to hyperosmotic stress, heat-shock and UV-B radiation. Moreover, the ΔMaGyp3 mutant showed a significantly decreased pathogenicity owing to delayed germination, reduced appressorium-mediated penetration and impaired invasive growth. Loss of MaGyp3 also caused impaired fungal growth, advanced conidiation and defects in utilization of carbon and nitrogen sources, while overexpression of MaGyp3 exhibited delayed conidiation on nutrient-rich medium and conidiation pattern shift from microcycle conidiation to normal conidiation on nutrient-limited medium. Mavib-1, a tanscription factor invloved in conidiation by affecting nutrient utilizaiton, can directly bind to the promoter of MaGyp3. ΔMaGyp3 and ΔMavib-1 mutants shared similar phenotypes, and overexpression mutants of MaGyp3 and Mavib-1 (Mavib-1-OE) exhibited similar phenotypes in growth, conidiation and pathogenicity. Reintroduction of the Magyp3 driven by strong promoter gpd in ΔMavib-1 mutant recovered the defects in growth and conidiation for dysfunction of Mavib1. Taken together, our findings uncovered the role of GAP3 in a filamentous pathogenic fungus and and illustrated the upstream regulatory mechanism by direct interaction with Mavib-1.请用nature杂志的风格润色成学术论文的形式。
02-10
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

__night_

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值