#include <stdio.h> #include <queue> using namespace std; #define inf 2147483647 const int maxn = 10010, maxm = 500050; int n, m, s; struct edge { int to, weight, next; }; edge edges[maxm]; int head[maxn], edge_cnt; void add(int x, int y, int w) { edges[++edge_cnt].next = head[...