{"problem":{"name":"[Ynoi2000] pri","description":{"content":"给定 $1,\\dots,n$ 的排列 $a_1,\\dots,a_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$ 。","description_type":"Markdown"},"platform":"Luogu","limit":{"time_limit":5000,"memory_limit":524288},"difficulty":{"LuoguStyle":"P7"},"is_remote":true,"is_sync":true,"sync_url":null,"sign":"LGP10028"},"statements":[{"statement_type":"Markdown","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$ 。\n\n## Input\n\n第一行两个整数 $n,m$ ；\n\n第二行 $n$ 个整数依次表示 $a_1,\\dots,a_n$ ；\n\n接下来 $m$ 行，每行一个整数 $x$ ，表示一次操作。\n\n## Output\n\n共 $m$ 行，每行一个整数，依次表示每次操作的查询的答案。\n\n[samples]\n\n## Note\n\nIdea：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$。","is_translate":false,"language":"English"}],"meta":{"iden":"LGP10028","tags":["2000","O2优化","Ynoi"],"sample_group":[["6 5\n5 4 2 3 1 6\n3\n5\n6\n3\n6","3\n6\n4\n2\n10"]],"created_at":"2026-03-03 11:09:25"}}