Lang:G++
Edit12345678910111213141516171819202122232425262728293031#include <iostream>#include <stdio.h>#include <cmath>#include <math.h>#include <algorithm>#include <string.h>#include <set>#include <map>#include <queue>using namespace std;typedef pair<int,int> pa;typedef long long ll;const int inf=(1<<30);const int maxn=100005;struct node{ll wi;int parent;vector<int> child;set<ll> power;int powernum;}a[maxn];set<ll>::iterator s1;set<ll>::iterator s2;int du[maxn];void fun(int t){int tparent=a[t].parent;for(s1=a[t].power.begin();s1!=a[t].power.end();s1++){for(s2=a[tparent].power.begin();s2!=a[tparent].power.end();s2++){