{"problem":{"name":"E. Simple sequence","description":{"content":"You are given an array (s) of positive integers having the length n. Let's define the subarray as the array between some indexes l and r (l ≤ r and elements are sl, sl + 1, ..., sr). We call the suba","description_type":"Markdown"},"platform":"Codeforces","limit":{"time_limit":1000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"CF10049E"},"statements":[{"statement_type":"Markdown","content":"You are given an array (s) of positive integers having the length n.\n\nLet's define the subarray as the array between some indexes l and r (l ≤ r and elements are sl, sl + 1, ..., sr). We call the subarray \"simple\" if mn is the minimal element in this subarray, mx is the maximal element in this subarray, a is a given parameter and inequality  is satisfied. \n\nYou need to find the size of the biggest possible simple subarray.\n\nThe first line contains the number of test cases T (1 ≤ T ≤ 50).\n\nIn the first line of every test case there are two integers n (1 ≤ n ≤ 105) and a (1 ≤ a ≤ 109) - the size of the array and the described parameter. \n\nIn the second line of every test case there are n integers si (1 ≤ si ≤ 109) - the elements of the array.\n\nFor each test case output one line containing “_Case #tc: size_” where tc is the number of the test case (starting from 1) and size is the size of the biggest possible simple subarray.\n\n## Input\n\nThe first line contains the number of test cases T (1 ≤ T ≤ 50).In the first line of every test case there are two integers n (1 ≤ n ≤ 105) and a (1 ≤ a ≤ 109) - the size of the array and the described parameter. In the second line of every test case there are n integers si (1 ≤ si ≤ 109) - the elements of the array.\n\n## Output\n\nFor each test case output one line containing “_Case #tc: size_” where tc is the number of the test case (starting from 1) and size is the size of the biggest possible simple subarray.\n\n[samples]","is_translate":false,"language":"English"},{"statement_type":"Markdown","content":"**Definitions**  \nLet $ T $ be the number of test cases, $ T \\leq 20 $.  \nFor each test case, let $ G = (V, E) $ be a binary tree with node set $ V $ and parent-child edges encoding left/right relationships. Each node $ v \\in V $ has an associated key $ k_v \\in \\mathbb{R} $.  \n\n**Constraints**  \n1. $ 1 \\leq T \\leq 20 $  \n2. $ G $ is a binary tree: each node has at most two children (left and right).  \n3. Node keys are comparable real numbers.  \n\n**Objective**  \nFind the maximum cardinality of a subset $ S \\subseteq V $ such that:  \n- The induced subgraph on $ S $ is connected (in the tree sense), and  \n- The subgraph formed by $ S $, with inherited left/right child relations and ancestor relationships, satisfies the binary search tree property:  \n  For every node $ v \\in S $, all keys in the left subtree of $ v $ (within $ S $) are $ < k_v $, and all keys in the right subtree of $ v $ (within $ S $) are $ > k_v $.  \n\nOutput: $ \\max |S| $ for each test case.","is_translate":false,"language":"Formal"}],"meta":{"iden":"CF10049E","tags":[],"sample_group":[],"created_at":"2026-03-03 11:00:39"}}