View Code #include<stdio.h>#include<string.h>int map[105][105];int main(){ int n,m,a,b; int i,j,k; scanf("%d%d",&n,&m); memset(map,0,sizeof(map)); for(i=0;i<m;i++) { scanf("%d%d",&a,&b); map[a][b]=1; } for(k=1;k<=n;k++) for(i=1;i<=n;i++) for(j Read More
View Code #include<stdio.h>#include<string.h>#define MAXN 101000#define INF 2000000struct NODE{ int v; int w; NODE *next;}edge[MAXN],redge[MAXN],temp[MAXN*2];int pos=0;int ecost[MAXN];int N,M,W,s,Q[MAXN];bool vis[MAXN];void spfa(int dir)//0为正向,1为反向{ int head,rear,u,i; NODE*ptr; hea... Read More