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;
}
全部评论

相关推荐

05-29 22:11
门头沟学院 Java
Elastic90:抛开学历造假不谈,这公司的招聘需求也挺怪的,Java开发还要求你有图文识别、移动端开发和c++的经验,有点逆天了。
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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