{"problem":{"name":"D. Sequences","description":{"content":"One of the most wonderful qualities of an ACMer is to be multi interests so he combines multiple qualifications and hobbies not just coding.  Hussain is one of the most qualified ACMers to mention whe","description_type":"Markdown"},"platform":"Codeforces","limit":{"time_limit":1000,"memory_limit":4096},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"CF10102D"},"statements":[{"statement_type":"Markdown","content":"One of the most wonderful qualities of an ACMer is to be multi interests so he combines multiple qualifications and hobbies not just coding.  Hussain is one of the most qualified ACMers to mention when talking about hobbies and other domains of personality training despite of his qualifications in ACM problem solving and math. It's very known about Hussain his obsession in hunting and shooting, he used to pass hours training on empty cans in his childhood.  These days, Hussain became a professional and still challenge others in this game, but for his bad luck he accidentally challenged a professional ACMer, without mentioning the name, so this ACMer made a game for Hussain.  He numbered N targets for Hussain with random numbers and challenged him to shoot the minimum number of targets so the remaining numbers will form a sequence of increasing (by one) numbers in their current order.  Example:  if there is 6 targets numbered as follow:  2 5 7 3 2 4 Hussain will shoot 5,7 and the second 2 remaining for 2 3 4.  Now, Hussain will focus on shooting, we will help him and focus on the targets he must shoot.  But No! Hussain is an very good ACMer, we will make it hard for him and just tell him the number of the remaining targets in the sequence. \n\nFirst line contain an integer T represents the number of test cases 0 < T < 100, each test case consists of two lines, the first one is an integer 0< N < 20000 represents the number of targets, then followed by the second line that contains N numbers each number 0 < Xi < 20000 represents the number written on the i'th target. \n\nFor each test case print one number represents the remaining sequence’s length can be created by the input where it should be the maximum length and each number of it follow its previous by 1. \n\nPlease consider a large input file.\n\n## Input\n\nFirst line contain an integer T represents the number of test cases 0 < T < 100, each test case consists of two lines, the first one is an integer 0< N < 20000 represents the number of targets, then followed by the second line that contains N numbers each number 0 < Xi < 20000 represents the number written on the i'th target. \n\n## Output\n\nFor each test case print one number represents the remaining sequence’s length can be created by the input where it should be the maximum length and each number of it follow its previous by 1. \n\n[samples]\n\n## Note\n\nPlease consider a large input file.","is_translate":false,"language":"English"},{"statement_type":"Markdown","content":"**Definitions**  \nLet $ T \\in \\mathbb{Z} $ be the number of test cases.  \nFor each test case:  \n- Let $ R, C \\in \\mathbb{Z} $ denote the dimensions of the canvas, with $ 1 \\leq R, C \\leq 100 $.  \n- Let $ I \\in \\mathbb{Z} $ denote the number of instructions, with $ 1 \\leq I \\leq 100 $.  \n- Let $ \\mathcal{P} = (p_{i,j})_{1 \\leq i \\leq R,\\, 1 \\leq j \\leq C} $ be the canvas, initially filled with `'.'`.  \n- Each instruction is a tuple $ (r_1, c_1, r_2, c_2, \\text{color}) $, where:  \n  - $ 1 \\leq r_1 \\leq r_2 \\leq R $,  \n  - $ 1 \\leq c_1 \\leq c_2 \\leq C $,  \n  - $ \\text{color} \\in \\{ \\text{ASCII characters } a\\text{-}z \\} $.  \n\n**Constraints**  \n1. $ 1 \\leq T \\leq \\text{unspecified (but reasonable)} $  \n2. For each instruction:  \n   - $ 1 \\leq r_1 \\leq r_2 \\leq R $  \n   - $ 1 \\leq c_1 \\leq c_2 \\leq C $  \n   - $ \\text{color} \\in \\{ \\text{a}, \\text{b}, \\dots, \\text{z} \\} $  \n\n**Objective**  \nFor each test case, process the $ I $ instructions in order. For instruction $ (r_1, c_1, r_2, c_2, \\text{color}) $, update:  \n$$\np_{i,j} \\leftarrow \\text{color} \\quad \\text{for all } i \\in \\{r_1, \\dots, r_2\\},\\, j \\in \\{c_1, \\dots, c_2\\}\n$$  \nOutput the final canvas $ \\mathcal{P} $ as $ R $ lines of $ C $ characters each.","is_translate":false,"language":"Formal"}],"meta":{"iden":"CF10102D","tags":[],"sample_group":[],"created_at":"2026-03-03 11:00:39"}}