CF2180H1.Bug Is Feature (Unconditional Version)

NOI/NOI+/CTSC

通过率:0%

时间限制:2.00s

内存限制:256MB

AC君温馨提醒

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

题目描述

This is the unconditional version of the problem. The difference between the versions is that in this version, there is no "non-decreasing common difference" condition. You can hack only if you solved all versions of this problem.

Note that neither version is necessarily easier than the other, and they can be solved independently.

Bug and Feature are immersed in a game of Sequence. In this unique version of the Sequence game, a sequence begins with three positive integers a<b<c≤xa \lt b \lt c \le x, forming an arithmetic progression (i.e., b−a=c−bb-a=c-b). During each turn, a player can selectively increase one of aa, bb, or cc by a positive integer. After the move, the numbers must retain their arithmetic progression, possibly with a new order. Moreover, none of aa, bb, or cc should exceed xx.

Not content with the conventional Sequence game, Bug and Feature decide to engage in a nn series of Sequence games simultaneously. For the ii-th series, they are provided with five numbers ai<bi<ci≤li≤ria_i \lt b_i \lt c_i \le l_i \le r_i. They will play a game with numbers ai<bi<ci≤xa_i \lt b_i \lt c_i \le x for every integer xx in the range [li,ri][l_i, r_i] (resulting in a total of ∑i=1n(ri−li+1)\sum_{i=1}^n (r_i - l_i + 1) games). Taking turns, they play all the games together, with Bug starting first and then Feature. In each turn, a player selects an unfinished game and makes a move in that game. The player who cannot make a move loses.

Now, the question is: if both players play optimally, who will emerge victorious?

这是该问题的无条件版本。两个版本的区别在于:在此版本中,没有“公差非递减”的限制条件。仅当您已解决该问题的所有版本时,才可进行 Hack。

请注意,两个版本之间并无必然的难易之分,且可独立求解。

Bug 与 Feature 正沉浸于一场名为“序列(Sequence)”的游戏之中。在此独特版本的序列游戏中,一个序列由三个正整数 a<b<c≤xa \lt b \lt c \le x 开始,构成一个等差数列(即满足 b−a=c−bb-a=c-b)。在每一回合中,玩家可选择将 aa、bb 或 cc 中的某一个数增加一个正整数。移动之后,这三个数仍须构成一个等差数列(顺序可能改变),且 aa、bb、cc 中任意一个数均不得超过 xx。

Bug 与 Feature 不满足于常规的序列游戏,决定同时进行 nn 场序列游戏。对于第 ii 场系列游戏,他们获得五个数 ai<bi<ci≤li≤ria_i \lt b_i \lt c_i \le l_i \le r_i。他们将对区间 [li,ri][l_i, r_i] 内的每一个整数 xx,分别以 ai<bi<ci≤xa_i \lt b_i \lt c_i \le x 为初始状态进行一局游戏(总计进行 ∑i=1n(ri−li+1)\sum_{i=1}^n (r_i - l_i + 1) 局游戏)。所有游戏同步进行,双方轮流行动,Bug 先手,随后是 Feature。在每一回合中,当前玩家需选择一个尚未结束的游戏,并在其中执行一次合法移动。无法进行任何移动的玩家判负。

现在的问题是:若双方均采取最优策略,谁将获胜?

输入格式

Each test contains multiple test cases. The first line contains the number of test cases tt (1≤t≤1051 \le t \le 10^5). The description of the test cases follows.

The first line of each test case consists of a single integer nn (1≤n≤2⋅1051 \le n \le 2 \cdot 10^5) — the number of series of games that Bug and Feature wish to play.

Each of the next nn lines contains five integers ai,bi,ci,li,ria_i, b_i, c_i, l_i, r_i — (1≤ai<bi<ci≤li≤ri≤10181 \le a_i \lt b_i \lt c_i \le l_i \le r_i \le 10^{18}), representing the specifications of the ii-th series of games. aia_i, bib_i, and cic_i form an arithmetic progression. (ci−bi=bi−ai)(c_i-b_i=b_i-a_i)

The sum of nn over all test cases is at most 2⋅1052 \cdot 10^5.

每个测试包含多个测试用例。第一行包含测试用例的数量 tt(1≤t≤1051 \le t \le 10^5)。随后是各测试用例的描述。

每个测试用例的第一行包含一个整数 nn(1≤n≤2⋅1051 \le n \le 2 \cdot 10^5)—— 表示 Bug 和 Feature 希望进行的游戏系列数量。

接下来的 nn 行中,每行包含五个整数 ai,bi,ci,li,ria_i, b_i, c_i, l_i, r_i(满足 1≤ai<bi<ci≤li≤ri≤10181 \le a_i \lt b_i \lt c_i \le l_i \le r_i \le 10^{18}),表示第 ii 个游戏系列的参数。其中 aia_i、bib_i 和 cic_i 构成一个等差数列(即 ci−bi=bi−aic_i - b_i = b_i - a_i)。

所有测试用例的 nn 值之和不超过 2⋅1052 \cdot 10^5。

输出格式

For each test, output Bug\mathtt{Bug} if Bug wins, and Feature\mathtt{Feature} if Feature wins.

对于每组测试,如果 Bug 获胜,则输出 Bug\mathtt{Bug};如果 Feature 获胜,则输出 Feature\mathtt{Feature}。

输入输出样例

  • 输入#1

    5
    1
    1 3 5 5 6
    1
    2 4 6 8 10
    2
    4 6 8 10 11
    4 8 12 16 19
    1
    1 2 3 3 3
    1
    1000000000000 2000000000000 3000000000000 4000000000000 5000000000000

    输出#1

    Bug
    Bug
    Feature
    Feature
    Feature

说明/提示

In the first test case, there are 22 instances of the game, corresponding to each value of xx in the range 55 to 66. The sequence in each instance is initially 1,  3,  51,\;3,\;5.

Bug can secure a winning strategy as follows:

  1. In the instance with x=5x = 5, Bug changes aa from 11 to 44. Consequently, the sequence becomes 3,  4,  53,\;4,\;5, and it is easy to verify that no further move is possible in this instance.

  2. Next, Feature must play by changing the value of aa from 11 to 44 in the instance with x=6x = 6.

  3. Then, Bug responds by changing bb from 33 to 66 in the instance with x=6x = 6. After this move, the sequence in that instance also becomes fixed, and no further operation can be performed.

Thus, after these moves, both instances reach states where no player can make any additional move, ensuring Bug's victory.

在第一个测试用例中,共有 22 个游戏实例,分别对应 xx 在区间 55 到 66 内的每个取值。每个实例的初始序列为 1,  3,  51,\;3,\;5。

Bug 可以采取如下策略确保获胜:

  1. 在 x=5x = 5 的实例中,Bug 将 aa 从 11 改为 44。于是序列变为 3,  4,  53,\;4,\;5,容易验证该实例中已无法进行任何进一步操作。

  2. 接着,Feature 必须在 x=6x = 6 的实例中将 aa 从 11 改为 44。

  3. 然后,Bug 在 x=6x = 6 的实例中将 bb 从 33 改为 66。此次操作后,该实例中的序列也变为固定状态,无法再执行任何操作。

因此,经过上述操作后,两个实例均达到无法继续操作的状态,从而确保 Bug 获胜。

输入解题思路,AI测评打分。不知道怎么写?

首页