{"trustable":false,"prependHtml":"\u003cstyle type\u003d\u0027text/css\u0027\u003e\n .input, .output {\n border: 1px solid #888888;\n }\n .output {\n margin-bottom: 1em;\n position: relative;\n top: -1px;\n }\n .output pre, .input pre {\n background-color: #EFEFEF;\n line-height: 1.25em;\n margin: 0;\n padding: 0.25em;\n }\n \u003c/style\u003e\n \u003clink rel\u003d\"stylesheet\" href\u003d\"//codeforces.org/s/96598/css/problem-statement.css\" type\u003d\"text/css\" /\u003e\u003cscript\u003e window.katexOptions \u003d { disable: true }; \u003c/script\u003e\n\u003cscript type\u003d\"text/x-mathjax-config\"\u003e\n MathJax.Hub.Config({\n tex2jax: {\n inlineMath: [[\u0027$$$\u0027,\u0027$$$\u0027], [\u0027$\u0027,\u0027$\u0027]],\n displayMath: [[\u0027$$$$$$\u0027,\u0027$$$$$$\u0027], [\u0027$$\u0027,\u0027$$\u0027]]\n }\n });\n\u003c/script\u003e\n\u003cscript type\u003d\"text/javascript\" async src\u003d\"https://mathjax.codeforces.org/MathJax.js?config\u003dTeX-AMS_HTML-full\"\u003e\u003c/script\u003e","sections":[{"title":"","value":{"format":"MD","content":"有一颗 N 个节点的树,树根编号为 1。\n树的每个节点有一个权值 A_i,树上有 N-1 条边 (u_i, v_i)。\n现在,你要对这棵树进行 Q 次 下列操作之一。\n操作1:选定一个节点 x,将其权值加上 val,将其儿子的权值减去 val,将其儿子的儿子的权值加上 val ... 加减操作会在叶节点完成后终止。\n操作2:询问节点 x 的点权。\n可以利用样例理解一下题意。。。"}},{"title":"Constraints","value":{"format":"MD","content":"1 \u003c\u003d N, Q \u003c\u003d 200000\n1 \u003c\u003d A_i \u003c\u003d 1000\n1 \u003c\u003d u_i, v_i \u003c\u003d N\n1 \u003c\u003d x \u003c\u003d N\n1 \u003c\u003d val \u003c\u003d 1000"}},{"title":"Input","value":{"format":"MD","content":"N Q\n\nA_1 A_2 ... A_N\n\nu_1 v_1\nu_2 v_2\n...\nu_N-1 v_N-1\n\n操作类型 参数\n若操作为 1 则为 1 x val\n若操作为 2 则为 2 x"}},{"title":"Output","value":{"format":"MD","content":"对于每一个操作 2,每行输出询问答案。"}},{"title":"Examples","value":{"format":"MD","content":"\u003cdiv class\u003d\"sample-test\"\u003e\n \u003cdiv class\u003d\"input\"\u003e\n \u003cdiv class\u003d\"title\"\u003e\n Input\n \u003c/div\u003e\n \u003cpre\u003e5 5\u003cbr\u003e1 2 1 1 2\u003cbr\u003e1 2\u003cbr\u003e1 3\u003cbr\u003e2 4\u003cbr\u003e2 5\u003cbr\u003e1 2 3\u003cbr\u003e1 1 2\u003cbr\u003e2 1\u003cbr\u003e2 2\u003cbr\u003e2 4\u003cbr\u003e\u003c/pre\u003e\n \u003c/div\u003e\n \u003cdiv class\u003d\"output\"\u003e\n \u003cdiv class\u003d\"title\"\u003e\n Output\n \u003c/div\u003e\n \u003cpre\u003e3\u003cbr\u003e3\u003cbr\u003e0\u003cbr\u003e\u003c/pre\u003e\n \u003c/div\u003e\n\u003c/div\u003e"}}]}