{"trustable":true,"sections":[{"title":"","value":{"format":"MD","content":"两个数列 $\\{A_n\\}$ , $\\{B_n\\}$ ,请求出 $Ans, Ans$ 定义如下:\r\n\r\n$Ans:\u003d\\Sigma_{i\u003d1}^n\\Sigma_{j\u003di}^n[max\\{A_i,A_{i+1},\\cdots ,A_j\\}\u003dmax\\{B_i,B_{i+1},\\cdots ,B_j\\}]$\r\n\r\n注:[ ]内表达式为真,则为 $1$ ,否则为 $0$ . \r\n\r\n$1\\le N \\le 3.5\\times10^5 \\\\ 1\\le A_i,B_i \\le N$\r\n\r\n样例解释:\r\n\r\n$7$ 个区间分别为:( $1,4$ ),( $1,5$ ),( $2,4$ ),( $2,5$ ),( $3,3$ ),( $3,5$ ),( $4,5$ )"}},{"title":"Input","value":{"format":"MD","content":"第一行一个整数 $N$\r\n第二行 $N$ 个整数 $Ai$\r\n第三行 $N$ 个整数 $Bi$"}},{"title":"Output","value":{"format":"MD","content":"一行,一个整数 $Ans$"}},{"title":"Sample 1","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\u003e5\n1 4 2 3 4\n3 2 2 4 1\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e7\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}}]}