->题目链接
先存图,输入时对每个输入节点,把序号推入队列,非输入点,用他的活跃度直接减去它的阈值,然后处理队列;
处理队列,也就是拓扑,每次拿出一个节点,处理他的每条边,更新边的尾节点的活跃度和推入队列,最后排序输出;
#include<queue>
#include<cstdio>
#include<iostream>
#include<algorithm>
#define N 10200
#define M N*N
using namespace std;
queue<int> q;
struct edge{
int to,val,from,next;
}e[M];
struct answ{
int num,val;
}ans[N];
int h,m,n,t,u,v,w,x,c[N],hd[N];
bool out[N],vis[N];
bool cmp(answ a, answ b)
{