{"trustable":true,"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\n\u003cscript\u003e\n window.katexOptions \u003d {\n delimiters: [\n {left: \u0027$$$$$$\u0027, right: \u0027$$$$$$\u0027, display: true},\n {left: \u0027$$$\u0027, right: \u0027$$$\u0027, display: false},\n {left: \u0027$$\u0027, right: \u0027$$\u0027, display: true},\n {left: \u0027$\u0027, right: \u0027$\u0027, display: false}\n ]\n };\n\u003c/script\u003e\n","sections":[{"title":"","value":{"format":"HTML","content":"\u003cp\u003e给定两个排列 $$$a$$$ 和 $$$b$$$,它们都由 $$$n$$$ 个元素组成。排列是一种整数序列,其中从 $$$1$$$ 到 $$$n$$$ 的每个值恰好出现一次。\u003c/p\u003e\u003cp\u003e你需要使用以下两种类型的查询:\u003c/p\u003e\u003cul\u003e \u003cli\u003e $$$1~l_a~r_a~l_b~r_b$$$ — 计算排列 $$$a$$$ 的位置段 $$$[l_a; r_a]$$$ 和排列 $$$b$$$ 的位置段 $$$[l_b; r_b]$$$ 中出现的相同值的数量; \u003c/li\u003e\u003cli\u003e $$$2~x~y$$$ — 交换排列 $$$b$$$ 中位置 $$$x$$$ 和 $$$y$$$ 的值。 \u003c/li\u003e\u003c/ul\u003e\u003cp\u003e对于每个第一种类型的查询,输出查询的答案。\u003c/p\u003e\u003cp\u003e保证输入中至少会有一个第一种类型的查询。\u003c/p\u003e"}},{"title":"输入","value":{"format":"HTML","content":"\u003cp\u003e第一行包含两个整数 $$$n$$$ 和 $$$m$$$ ($$$2 \\le n \\le 2 \\cdot 10^5$$$, $$$1 \\le m \\le 2 \\cdot 10^5$$$),分别表示两个排列的元素数量和查询数量。\u003c/p\u003e\u003cp\u003e第二行包含 $$$n$$$ 个整数 $$$a_1, a_2, \\dots, a_n$$$ ($$$1 \\le a_i \\le n$$$),表示排列 $$$a$$$。保证每个值从 $$$1$$$ 到 $$$n$$$ 在 $$$a$$$ 中恰好出现一次。\u003c/p\u003e\u003cp\u003e第三行包含 $$$n$$$ 个整数 $$$b_1, b_2, \\dots, b_n$$$ ($$$1 \\le b_i \\le n$$$),表示排列 $$$b$$$。保证每个值从 $$$1$$$ 到 $$$n$$$ 在 $$$b$$$ 中恰好出现一次。\u003c/p\u003e\u003cp\u003e接下来的 $$$m$$$ 行中包含特定查询的描述。这些描述要么是:\u003c/p\u003e\u003cul\u003e \u003cli\u003e $$$1~l_a~r_a~l_b~r_b$$$ ($$$1 \\le l_a \\le r_a \\le n$$$, $$$1 \\le l_b \\le r_b \\le n$$$); \u003c/li\u003e\u003cli\u003e $$$2~x~y$$$ ($$$1 \\le x, y \\le n$$$, $$$x \\ne y$$$). \u003c/li\u003e\u003c/ul\u003e"}},{"title":"输出","value":{"format":"HTML","content":"\u003cp\u003e对于第一种类型的查询,每个答案占一行,表示排列 $$$a$$$ 的位置段 $$$[l_a; r_a]$$$ 和排列 $$$b$$$ 的位置段 $$$[l_b; r_b]$$$ 中出现的相同值的数量。\u003c/p\u003e"}},{"title":"示例","value":{"format":"HTML","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\u003e6 7\n5 1 4 2 3 6\n2 5 3 1 4 6\n1 1 2 4 5\n2 2 4\n1 1 2 4 5\n1 2 3 3 5\n1 1 6 1 2\n2 4 1\n1 4 4 1 3\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e1\n1\n1\n2\n0\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e"}},{"title":"注意","value":{"format":"HTML","content":"\u003cp\u003e考虑第一个示例中的第一个查询。在排列 $$$a$$$ 的位置段 $$$[1; 2]$$$ 上的值是 $$$[5, 1]$$$,在排列 $$$b$$$ 的位置段 $$$[4; 5]$$$ 上的值是 $$$[1, 4]$$$。只有值 $$$1$$$ 出现在两个位置段中。\u003c/p\u003e\u003cp\u003e进行第一次交换后(第二个查询),排列 $$$b$$$ 变为 $$$[2, 1, 3, 5, 4, 6]$$$。\u003c/p\u003e\u003cp\u003e进行第二次交换后(第六个查询),排列 $$$b$$$ 变为 $$$[5, 1, 3, 2, 4, 6]$$$。\u003c/p\u003e"}}]}