12 2024 档案

摘要:区别在于图的可达性。如果由任意节点出发(以任意节点为根)可以到达所有节点, 那么遍历就只需要跑一次dfs;若可达性无法保证,则需要多次运行dfs; #include<bits/stdc++.h> using namespace std; #define N 10001 int m,n; int vt 阅读全文
posted @ 2024-12-07 09:29 邓佑孤 阅读(41) 评论(0) 推荐(0)
摘要:#include<bits/stdc++.h> using namespace std; #define N 10001 int m,n,t; int dp[N]; vector<pair<int,int>>v[N]; int main() { cin>>m>>n; int a,b,x; for(i 阅读全文
posted @ 2024-12-06 09:29 邓佑孤 阅读(13) 评论(0) 推荐(0)
摘要:样题通往奥格瑞玛的道路 #include<bits/stdc++.h> using namespace std; const int N=10001; long long f[N]; vector<pair<int,long long>>vec[N]; priority_queue<pair<lon 阅读全文
posted @ 2024-12-04 19:57 邓佑孤 阅读(36) 评论(0) 推荐(0)
摘要:图有最小生成树的充要条件:图是可达的 常见表述:从某节点出发可到达其余节点 #include<bits/stdc++.h> using namespace std; struct edge { int a,b,w; bool operator<(edge &other) { return w<oth 阅读全文
posted @ 2024-12-02 20:13 邓佑孤 阅读(19) 评论(0) 推荐(0)
摘要:题目传送门 #include<bits/stdc++.h> using namespace std; #define max(a,b) a>b?a:b #define min(a,b) a>b?b:a int n;int a[1001];int g[1001][1001]; int main() { 阅读全文
posted @ 2024-12-02 11:22 邓佑孤 阅读(20) 评论(0) 推荐(0)