{"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":"HTML","content":"\u003cscript type\u003d\u0027text/x-mathjax-config\u0027\u003eMathJax.Hub.Config({tex2jax: { inlineMath: [[\u0027$\u0027,\u0027$\u0027]] } }); \u003c/script\u003e\n\u003cscript type\u003d\u0027text/javascript\u0027 src\u003d\u0027https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config\u003dTeX-AMS-MML_HTMLorMML\u0027\u003e\u003c/script\u003e\n\u003cscript type\u003d\u0027text/javascript\u0027\u003esetTimeout(function(){MathJax.Hub.Queue([\u0027Typeset\u0027, MathJax.Hub, \u0027left_view\u0027]);}, 2000);\u003c/script\u003e\n\u003cdiv class\u003d\"panel_content\"\u003e\n Data structure is one of the basic skills for Computer Science students, which is a particular way of storing and organizing data in a computer so that it can be used efficiently. Today let me introduce a data-structure-like problem for you. \n \u003cbr\u003eOriginal, there are N numbers, namely 1, 2, 3...N. Each round, iSea find out the Ki-th smallest number and take it away, your task is reporting him the total sum of the numbers he has taken away. \n \u003cbr\u003e \n\u003c/div\u003e\n在一个含有1-n的序列中,每次找到第Ki小的数,并把它删除。"}},{"title":"Input","value":{"format":"HTML","content":"The first line contains a single integer T, indicating the number of test cases. \n\u003cbr\u003eEach test case includes two integers N, K, K indicates the round numbers. Then a line with K numbers following, indicating in i (1-based) round, iSea take away the Ki-th smallest away. \n\u003cbr\u003e \n\u003cbr\u003e \n\u003cb\u003eTechnical Specification\u003c/b\u003e \n\u003cbr\u003e1. 1 \u0026lt;\u003d T \u0026lt;\u003d 128 \n\u003cbr\u003e2. 1 \u0026lt;\u003d K \u0026lt;\u003d N \u0026lt;\u003d 262 144 \n\u003cbr\u003e3. 1 \u0026lt;\u003d Ki \u0026lt;\u003d N - i + 1 \n\u003cbr\u003e\n第一个数T,表示测试数据的组数。\u003c/br\u003e\n每组测试数据,第一行2个整数n和m,m表示操作的轮数。\u003c/br\u003e\n接下来m行,每行一个整数k,表示要找出第k小的数,并把它删除。"}},{"title":"Output","value":{"format":"HTML","content":"For each test case, output the case number first, then the sum.\u003c/br\u003e\n每组数据,输出一个整数,表示删除元素的总和。"}},{"title":"Sample Input","value":{"format":"HTML","content":"\u003cpre\u003e2\n3 2\n1 1\n10 3\n3 9 1\u003c/pre\u003e"}},{"title":"Sample Output","value":{"format":"HTML","content":"\u003cpre\u003eCase 1: 3\nCase 2: 14\u003c/pre\u003e"}}]}