QOJ.ac

QOJ

Time Limit: 1 s Memory Limit: 512 MB Total points: 100 Difficulty: [show]

#5141. 奇偶性相同

Statistics

定义一个序列的价值为其中所有数字的和。

判断是否存在一个长度为 $n$ 的排列,使得该排列中所有长度为 $k$ 的子段的价值具有相同的奇偶性。价值具有相同的奇偶性是指它们要么全是奇数,要么全是偶数。

子段是排列的一个连续子序列。长度为 $n$ 的排列是一个包含从 $1$ 到 $n$ 每个整数恰好一次的序列。

输入格式

第一行包含一个整数 $T$ ($1 \le T \le 10^5$),表示测试用例的数量。

对于每个测试用例,唯一的一行包含两个整数 $n, k$ ($1 \le k \le n \le 10^9$)。

输出格式

对于每个测试用例,如果存在合法的排列,输出 “Yes”(不含引号),否则输出 “No”(不含引号)。

你可以以任何大小写形式输出 “Yes” 和 “No”(例如,字符串 “YES”、“yEs” 和 “yes” 都会被识别为肯定回答)。

样例

输入 1

3
3 1
4 2
5 3

输出 1

No
Yes
Yes

说明

在第一个测试用例中,可以证明不存在任何合法的排列。

在第二个测试用例中,$[1, 2, 3, 4]$ 是一个合法的排列。其长度为 $2$ 的子段为 $[1, 2], [2, 3], [3, 4]$。它们的价值分别为 $3, 5, 7$。它们具有相同的奇偶性。

在第三个测试用例中,$[1, 2, 3, 5, 4]$ 是一个合法的排列。其长度为 $3$ 的子段为 $[1, 2, 3], [2, 3, 5], [3, 5, 4]$。它们的价值分别为 $6, 10, 12$。它们具有相同的奇偶性。

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.