APIO 2014 Beads and Wires
Author: Andi Qu
This section is not complete.
Feel free to file a request to complete this using the "Contact Us" button.
Code
#include <bits/stdc++.h>typedef long long ll;using namespace std;int n, a, b;ll w, pw[200001], dp[200001][2][2];vector<pair<int, ll>> graph[200001];void dfs(int node, int par) {if (graph[node].size() == 1 && par != -1) return;