{"trustable":false,"prependHtml":"\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 async src\u003d\"https://mathjax.codeforces.org/MathJax.js?config\u003dTeX-AMS-MML_HTMLorMML\" type\u003d\"text/javascript\"\u003e\u003c/script\u003e","sections":[{"title":"","value":{"format":"MD","content":"抗日战争时期,地道战在华北平原广大地区广泛开展。\n\n有 $n$ 个村庄排成一排,依次编号 $1 \\\\sim n$。\n\n初始时,任意两个**相邻**村庄之间可以通过地道保持连通。\n\n接下来共发生了 $m$ 个事件,事件分为以下三种:\n\n* `D x`,鬼子袭击第 $x$ 个村庄,如果第 $x$ 个村庄的地道完好,则将其毁掉。被毁掉地道的村庄无法通往其他村庄,反之亦然。\n* `Q x`,八路军司令询问从第 $x$ 个村庄可以到达多少个**地道完好**的村庄(包括第 $x$ 个村庄本身)。\n* `R`,八路军战士来到鬼子最近一次袭击的村庄,如果该村庄的地道被毁坏,则将地道修好。\n\n对于所有的询问事件,请你做出回答。"}},{"title":"Input","value":{"format":"MD","content":"输入包含多组测试数据。\n\n每组数据第一行包含两个整数 $n,m$。\n\n接下来 $m$ 行,每行描述一个事件,格式如题面所述。"}},{"title":"Output","value":{"format":"MD","content":"每个询问输出一行回答。"}},{"title":"Sample","value":{"format":"MD","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e\u003cpre\u003e7 9\nD 3\nD 6\nD 5\nQ 4\nQ 5\nR\nQ 4\nR\nQ 4\n\u003c/pre\u003e\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e\u003cpre\u003e1\n0\n2\n4\n\u003c/pre\u003e\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}},{"title":"数据范围","value":{"format":"MD","content":"每个输入最多包含 $10$ 组数据。 \n$1 \\\\le n,m \\\\le 50000$, \n$1 \\\\le x \\\\le n$。 \n地道已被毁坏的村庄仍可能受到袭击。"}}]}