文章

14

粉丝

0

获赞

3

访问

966

头像
继续畅通工程 题解:已经存在的路,成本为0即可
P1311 浙江大学机试题
发布于2025年8月16日 13:57
阅读数 78

#include <iostream>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <set>
#include <list>
#include <string>
#include <cmath>
#include <stack>
#include <map>
#include <sstream>
#include <queue>

using namespace std;

struct road {
    int target;
    int cost;
    int state;

};

struct compare_road {
    bool operator () ( road& a, road& b ) {
        return a.cost > b.cost;
    }
};

int main() {
    int n;
    while (cin >> n) {
        if (n == 0)break;
        int m = n*(n - 1) / 2;
        set<int>nodes;
        for (int i = 1; i <= n; i++) {
       &nbs...

登录查看完整内容


登录后发布评论

暂无评论,来抢沙发