Well .. Weak and violent fruit
When the 0 operation is performed, add V to u. You can directly add V to the point connected to u. In this way, the value of the required point is output directly.
In this case, I timed out ..
# Include <cstdio> # include <cstring> # include <cmath> # include <iostream> # include <algorithm> # include <vector> # include <queue> const int maxn = 100010; using namespace STD; vector <int> E [maxn]; int n, m, Val [maxn], C; int main () {// freopen ("in.txt ", "r", stdin); // freopen ("out.txt", "W", stdout); int T, A, B, I, Q; scanf ("% d ", & T); While (t --) {scanf ("% d", & N, & M); for (I = 0; I <= N; I ++) E [I]. clear (); memset (Val, 0, sizeof Val); While (M --) {scanf ("% d", & A, & B ); E [A]. push_back (B); E [B]. push_back (a);} scanf ("% d", & Q); While (Q --) {scanf ("% d", & ); if (A = 0) {scanf ("% d", & A, & C); for (I = 0; I <E [A]. size (); I ++) Val [E [a] [I] + = C;} else {scanf ("% d", & ); printf ("% d \ n", Val [a]) ;}} return 0 ;}