12311

#include<bits/stdc++.h>
using namespace std;
const int maxn=1e5+10;
struct dd {
    int to,cost;
    dd(int xx=0,int yy=0):to(xx),cost(yy) {
    }
    bool operator >(const dd&aa)const {
        return cost>aa.cost;
    }
};
priority_queue<dd,vector<dd>,greater<dd> >op;
int main() {
    int n,m;
    for(int i=1; i<=m; i++) {
        int a;
        cin>>a;
        if(a==3) {
            int b,c;
            cin>>b>>c;
            //b-c>=0
            //b-c<=0
            g[b].push_back(dd(a,0));
            g[a].push_back(dd(b,0));
        } else if(a==1) {
            int b,c,d;
            cin>>b>>c>>d;
            //b-c>=d; b>=c+d; b+(-d)>=c c是节点
            g[b].push_back(dd(c,-d));
        } else {
            int b,c,d;
            cin>>b>>c>>d;
            //b-c<=d; b<=c+d;  b是节点
            g[d].push_back(dd(b,d));
        }
    }
    return 0;
}
全部评论

相关推荐

点赞 评论 收藏
分享
在看牛客的社畜很积极:身高体重那一行信息去掉,学校那一行的信息放上面,找半天都没找到你是哪个学校什么专业的
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务