#include "stdio.h" #include "math.h" #include "queue" #include "stdlib.h" #include "string.h" #include "algorithm" #include "iostream" #define N 100005 #define inf 2147483646 #define eps 1e-8 #define pi acos(-1.0) using namespace std; typedef long long LL; struct dd { int num,id; }; int vis[N],w[25]; int n; void bfs() { dd p1,p2; queue