CF1826C.Dreaming of Freedom

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

Because to take away a man's freedom of choice, even his freedom to make the wrong choice, is to manipulate him as though he were a puppet and not a person.

— Madeleine L'Engle

There are nn programmers choosing their favorite algorithm amongst mm different choice options. Before the first round, all mm options are available. In each round, every programmer makes a vote for one of the remaining algorithms. After the round, only the algorithms with the maximum number of votes remain. The voting process ends when there is only one option left. Determine whether the voting process can continue indefinitely or no matter how people vote, they will eventually choose a single option after some finite amount of rounds?

输入格式

The first line contains a single integer tt ( 1t1051 \leq t \leq 10^5 ) — the number of test cases.

Each test case consists of a single line containing two integers nn and mm ( 1n,m1061 \leq n, m \leq 10^6 ) — the number of people and choice options respectively.

输出格式

For each test case output "YES" if the programmers will eventually choose a single option, and "NO" otherwise.

You may print each letter in any case (for example, YES, Yes, yes, yEs will all be recognized as a positive answer).

输入输出样例

  • 输入#1

    5
    3 2
    4 2
    5 3
    1000000 1000000
    1 1000000

    输出#1

    YES
    NO
    YES
    NO
    YES

说明/提示

In the first example, there are 88 ways people could vote: {111,112,121,122,211,212,221,222}\{1|1|1, 1|1|2, 1|2|1, 1|2|2, 2|1|1, 2|1|2, 2|2|1, 2|2|2\} .

In cases 11 , 22 , 33 , and 55 , the programmers are left with the first algorithm, and in the remaining cases people are left with the second one, so the voting ends in one round in any case.

In the second example, the programmers could always vote 11221|1|2|2 . Both algorithms have the maximum number of votes and remain for the next round, so the voting never ends.

首页