2026年10月6日

2 道题返回最新一期
F
Fighting the Rajasi
GYM101047F
1800GYM2 seconds64 megabytes
Codeforces

F. 与 Rajasi 战斗AI (CI翻译)(GLM 5.3 Flash)

题目描述

Muay Thai is a martial art originated in Thailand. Many of its practitioners became legends among Thai people. Among these legendary fighters, Nai Khanom Tom is considered the very best. Here's one of his famous anecdotes.

泰拳是一种起源于泰国的武术。许多泰拳练习者成为了泰国人民中的传奇。在这些传奇拳手中,乃克侬东被认为是最优秀的。以下是他的一则著名轶事。AI (CI翻译)(GLM 5.3 Flash)

Burma's king Mangra made Nai Khanom Tom, who was a war prisoner, duel one of the finest Burmese fighters in order to judge their fighting styles. Nai Khanom Tom effortlessly beat his opponent. However, the referee claimed that Nai Khanom Tom only won because he performed Ram Muay, a ritualistic dance move. The king then ordered Nai to duel ten Burmese warriors, one after another. Nai Khanom Tom still beat them all. Having witnessed Nai's skills, king Mangra set him free.

缅甸国王孟拉让战俘乃克侬东与缅甸最优秀的拳手之一决斗,以评判他们的格斗风格。乃克侬东轻松击败了对手。然而,裁判声称乃克侬东获胜只是因为他表演了拜师舞,一种仪式性的舞蹈动作。国王随后命令乃克侬东与十名缅甸武士依次决斗。乃克侬东仍然将他们全部击败。目睹了乃克侬东的技艺后,孟拉国王释放了他。AI (CI翻译)(GLM 5.3 Flash)

This tale has been passed across generations. Some people even believe Nai Khanom Tom could beat any number of opponents, even mythic Thai creatures.

这个故事代代相传。有些人甚至相信奈·坎侬·汤姆能击败任意数量的对手,甚至是泰国神话中的生物。AI (CI翻译)(GLM 5.3 Flash)

As a big Muay Thai fan, you want to verify this claim. Suppose Nai Khanom Tom has H hit points and has to duel against N Rajasis. Each of them has xi hit points and yi recovery points. To win a fight, Nai's hit points must be greater than the Rajasi's. After fighting, Nai loses xi hit points and recovers yi points afterwards. Moreover, Nai knows K spells that can instantly beat a Rajasi. However, when a spell is used, Nai does not lose nor wins hit points as in a usual fight.

作为一名狂热的泰拳迷,你想验证这个说法。假设 Nai Khanom Tom 有 H 点生命值,并且必须与 N 个 Rajasi 决斗。每个 Rajasi 都有 xi 点生命值和 yi 点恢复点数。要赢得一场战斗,Nai 的生命值必须大于 Rajasi 的生命值。战斗结束后,Nai 失去 xi 点生命值,随后恢复 yi 点。此外,Nai 知道 K 个可以瞬间击败一个 Rajasi 的法术。然而,当使用法术时,Nai 不会像通常战斗那样失去或获得生命值。AI (CI翻译)(GLM 5.3 Flash)

Given the description of a set of N Rajasis, you must decide if Nai Khanom Tom can beat them all. Note that Nai Khanom Tom can choose to fight the Rajasis in any order he wants.

给定一组 N 个 Rajasis 的描述,你必须判断 Nai Khanom Tom 能否击败他们全部。注意,Nai Khanom Tom 可以选择按他想要的任意顺序与 Rajasis 战斗。AI (CI翻译)(GLM 5.3 Flash)

输入格式

The first line has a single integer T, the number of test cases.

第一行有一个整数 T,表示测试用例的数量。AI (CI翻译)(GLM 5.3 Flash)

For each test case, the first line contains three space-separated integers, N, H, and K, where H is Nai's initial hit points. Each of the following N lines have two space-separated integers, xi and yi.

对于每个测试用例,第一行包含三个以空格分隔的整数 N、H 和 K,其中 H 是 Nai 的初始生命值。接下来的 N 行中,每行包含两个以空格分隔的整数 xi 和 yi。AI (CI翻译)(GLM 5.3 Flash)

Limits

限制AI (CI翻译)(GLM 5.3 Flash)

1 ≤ T ≤ 100

1 ≤ T ≤ 100AI (CI翻译)(GLM 5.3 Flash)

1 ≤ N ≤ 2·103

1 ≤ N ≤ 2·103AI (CI翻译)(GLM 5.3 Flash)

0 ≤ K ≤ N

0 ≤ K ≤ NAI (CI翻译)(GLM 5.3 Flash)

The sum of N across all test cases will not exceed 2·104.

所有测试用例中 N 的总和不会超过 2·104。AI (CI翻译)(GLM 5.3 Flash)

0 ≤ H, xi, yi ≤ 109

0 ≤ H, xi, yi ≤ 109AI (CI翻译)(GLM 5.3 Flash)

输出格式

For each test case, print a single line with Y if it is possible for Nai Khanom Tom to beat all Rajasis; print N otherwise.

对于每个测试用例,如果 Nai Khanom Tom 有可能击败所有 Rajasis,则输出一行 Y;否则输出 N。AI (CI翻译)(GLM 5.3 Flash)

样例

样例 1

Input
2
2 10 2
20 10
100 1
2 10 0
9 10
10 1
Output
Y
Y

C
AND PLUS OR
GYM103627C
2000GYM3 seconds1024 mebibytes
Codeforces

C. AND PLUS ORAI (CI翻译)(GLM 5.3 Flash)

题目描述

For two nonnegative integers $a, b$, let a∧b$a \wedge b$ be their bitwise AND, and a∨b$a \vee b$ be their bitwise OR.

对于两个非负整数$a, b$,令a∧b$a \wedge b$为它们的按位与,a∨b$a \vee b$为它们的按位或。AI (CI翻译)(GLM 5.3 Flash)

You are given an array $A_0, A_1, \ldots, A_{2^N - 1}$ of length $2^N$ consisting of nonnegative integers. Please find a pair of indices $0 \le i, j \le 2^N - 1$ such that Ai+Aj<Ai∧j+Ai∨j$A_{i} + A_{j} \lt A_{i \wedge j} + A_{i \vee j}$, or state that no such pair exists. If there is more than one such pair, find any one of them.

给定一个长度为 2N$A_0, A_1, \ldots, A_{2^N - 1}$ 的数组 A0,A1,…,A2N−1$2^N$,数组元素均为非负整数。请找出一对下标 $0 \le i, j \le 2^N - 1$,使得 Ai+Aj<Ai∧j+Ai∨j$A_{i} + A_{j} \lt A_{i \wedge j} + A_{i \vee j}$,或者指出不存在这样的下标对。如果存在多对,输出其中任意一对即可。AI (CI翻译)(DeepSeek V4 Flash)

输入格式

The first line contains an integer $N$ ($0 \leq N \leq 20$).

第一行包含一个整数 $N$ ($0 \leq N \leq 20$)。AI (CI翻译)(GLM 5.3 Flash)

The second line contains $2^N$ integers: $A_0, A_1, \ldots, A_{2^N - 1}$ ($0 \leq A_i \leq 10^7$).

第二行包含 $2^N$ 个整数:$A_0, A_1, \ldots, A_{2^N - 1}$ ($0 \leq A_i \leq 10^7$)。AI (CI翻译)(GLM 5.3 Flash)

输出格式

If there is an answer, output two integers $i$ and $j$ denoting the answer. The numbers $i$ and $j$ should be in the range $[0, 2^N - 1]$. Otherwise, output -1.

如果有答案,输出两个整数 $i$ 和 $j$ 表示该答案。数字 $i$ 和 $j$ 应在范围 $[0, 2^N - 1]$ 内。否则,输出 -1。AI (CI翻译)(GLM 5.3 Flash)

样例

样例 1

Input
2
0 1 1 2
Output
-1

样例 2

Input
2
0 1 1 3
Output
2 1

样例 3

Input
0
100
Output
-1