{"raw_statement":[{"iden":"statement","content":"给定 $1,\\dots,n$ 的排列 $a_1,\\dots,a_n$ ；\n\n共 $m$ 次操作，每次操作给出 $x$ ，首先进行修改，将 $a_1,a_2,\\dots,a_x$ 翻转为 $a_x,\\dots,a_2,a_1$ ，然后查询有多少组不同的 $(i,j)$ ，满足 $1\\le i<j\\le x$ 使得 $a_i<a_j$ 。"},{"iden":"input","content":"第一行两个整数 $n,m$ ；\n\n第二行 $n$ 个整数依次表示 $a_1,\\dots,a_n$ ；\n\n接下来 $m$ 行，每行一个整数 $x$ ，表示一次操作。"},{"iden":"output","content":"共 $m$ 行，每行一个整数，依次表示每次操作的查询的答案。"},{"iden":"note","content":"Idea：ccz181078，Solution：ccz181078，Code：ccz181078，Data：ccz181078\n\n所有数值为整数。\n\n对于 $100\\%$ 的数据，满足 $1\\le a_i\\le n$，$1\\le x\\le n$，$1\\le n\\le 2\\times 10^5,\\;1\\le m\\le 5\\times 10^4$。"}],"translated_statement":null,"sample_group":[["6 5\n5 4 2 3 1 6\n3\n5\n6\n3\n6","3\n6\n4\n2\n10"]],"show_order":[],"formal_statement":null,"simple_statement":null,"has_page_source":false}