int main() { int T; scanf("%d", &T); for(int cas = 1; cas <= T; cas++) { memset(v, 0, sizeof(v)); scanf("%d", &n); for(int i = 1; i < n; i++) { int x, y; scanf("%d%d", &x, &y); inLink(x, y); inLink(y, x); } int q; scanf("%d", &q); while(q--) { int a, b, c; scanf("%d%d%d", &a, &b, &c); found = (a == b); memset(vis, 0, sizeof(vis)); dfs(a, b, c); } printf("Case #%d:\n", cas); for(int i = 0; i < n; i++) printf("%d\n", v[i]); } return 0; }
void read() { scanf("%d",&m); while(m--) { int x,y,z; scanf("%d%d%d",&x,&y,&z); inLink(x,y,z); n=std::max(n,std::max(x,y)); } }
/* Just wrap the inLink() and call it push. */ int pushLink (link_t * head, void *val) { int cc; if (!head) return -1; cc = inLink (head, val); return cc; } /* pushLink() */