{"problem":{"name":"[ICPC 2022 Jinan R] Identical Parity","description":{"content":"Let the value of a sequence be the sum of all numbers in it. Determine whether there exists a permutation of length $n$ such that the values of all subsegments of length $k$ of the permutation share ","description_type":"Markdown"},"platform":"Luogu","limit":{"time_limit":1000,"memory_limit":524288},"difficulty":{"LuoguStyle":"P3"},"is_remote":true,"is_sync":true,"sync_url":null,"sign":"LGP9671"},"statements":[{"statement_type":"Markdown","content":"Let the value of a sequence be the sum of all numbers in it.\n\nDetermine whether there exists a permutation of length $n$ such that the values of all subsegments of length $k$ of the permutation share the same parity. The values share the same parity means that they are all odd numbers or they are all even numbers.\n\nA subsegment of a permutation is a contiguous subsequence of that permutation. A permutation of length $n$ is a sequence in which each integer from $1$ to $n$ appears exactly once.\n\n## Input\n\nThe first line contains one integer $T~(1\\le T \\le 10^5)$, the number of test cases.\n\nFor each test case, the only line contains two integers $n,k~(1 \\le k \\le n \\le 10^9)$.\n\n## Output\n\nFor each test case, output $\\texttt{Yes}$ (without quotes) if there exists a valid permutation, or $\\texttt{No}$ (without quotes) otherwise.\n\nYou can output $\\texttt{Yes}$ and $\\texttt{No}$ in any case (for example, strings $\\texttt{YES}$, $\\texttt{yEs}$ and $\\texttt{yes}$ will be recognized as positive responses).\n\n[samples]\n\n## Note\n\nIn the first test case, it can be shown that there does not exist any valid permutation.\n\nIn the second test case, $[1,2,3,4]$ is one of the valid permutations. Its subsegments of length $2$ are $[1,2],[2,3],[3,4]$. Their values are $3,5,7$, respectively. They share the same parity.\n\nIn the third test case, $[1,2,3,5,4]$ is one of the valid permutations. Its subsegments of length $3$ are $[1,2,3],[2,3,5],[3,5,4]$. Their values are $6,10,12$, respectively. They share the same parity.","is_translate":false,"language":"English"}],"meta":{"iden":"LGP9671","tags":["2022","Special Judge","O2优化","ICPC","济南"],"sample_group":[["3\n3 1\n4 2\n5 3","No\nYes\nYes"]],"created_at":"2026-03-03 11:09:25"}}