{"problem":{"name":"Smooth Subsequence","description":{"content":"You are given a sequence $A = (A_1, A_2, \\ldots, A_N)$ of length $N$. Find the maximum length of a subsequence of $A$ such that the absolute difference between any two adjacent terms is at most $D$. A","description_type":"Markdown"},"platform":"AtCoder","limit":{"time_limit":2000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"abc339_e"},"statements":[{"statement_type":"Markdown","content":"You are given a sequence $A = (A_1, A_2, \\ldots, A_N)$ of length $N$.\nFind the maximum length of a subsequence of $A$ such that the absolute difference between any two adjacent terms is at most $D$.\nA subsequence of a sequence $A$ is a sequence that can be obtained by deleting zero or more elements from $A$ and arranging the remaining elements in their original order.\n\n## Constraints\n\n*   $1 \\leq N \\leq 5 \\times 10^5$\n*   $0 \\leq D \\leq 5 \\times 10^5$\n*   $1 \\leq A_i \\leq 5 \\times 10^5$\n*   All input values are integers.\n\n## Input\n\nThe input is given from Standard Input in the following format:\n\n$N$ $D$\n$A_1$ $A_2$ $\\ldots$ $A_N$\n\n[samples]","is_translate":false,"language":"English"}],"meta":{"iden":"abc339_e","tags":[],"sample_group":[["4 2\n3 5 1 2","3\n\nThe subsequence $(3, 1, 2)$ of $A$ has absolute differences of at most $2$ between adjacent terms."],["5 10\n10 20 100 110 120","3"],["11 7\n21 10 3 19 28 12 11 3 3 15 16","6"]],"created_at":"2026-03-03 11:01:14"}}