CF566G.Max and Min

省选/NOI-

通过率:0%

时间限制:2.00s

内存限制:256MB

AC君温馨提醒

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

题目描述

Two kittens, Max and Min, play with a pair of non-negative integers x and y. As you can guess from their names, kitten Max loves to maximize and kitten Min loves to minimize. As part of this game Min wants to make sure that both numbers, x and y became negative at the same time, and kitten Max tries to prevent him from doing so.

Each kitten has a set of pairs of integers available to it. Kitten Max has n pairs of non-negative integers (a__i, b__i) (1 ≤ i ≤ n), and kitten Min has m pairs of non-negative integers (c__j, d__j) (1 ≤ j ≤ m). As kitten Max makes a move, it can take any available pair (a__i, b__i) and add a__i to x and b__i to y, and kitten Min can take any available pair (c__j, d__j) and subtract c__j from x and d__j from y. Each kitten can use each pair multiple times during distinct moves.

Max moves first. Kitten Min is winning if at some moment both numbers a, b are negative simultaneously. Otherwise, the winner of the game is kitten Max. Determine which kitten wins if both of them play optimally.

两只小猫,Max 和 Min,正在玩一对非负整数 xx 和 yy。顾名思义,小猫 Max 喜欢最大化,而小猫 Min 喜欢最小化。在本游戏中,Min 的目标是使两个数 xx 和 yy 同时变为负数,而 Max 则试图阻止这一情况发生。

每只小猫都拥有一组可供使用的整数对。小猫 Max 拥有 nn 对非负整数 (ai, bi)(a_i,\, b_i)(其中 1≤i≤n1 \le i \le n),而小猫 Min 拥有 mm 对非负整数 (cj, dj)(c_j,\, d_j)(其中 1≤j≤m1 \le j \le m)。当 Max 行动时,它可任选一对可用的 (ai, bi)(a_i,\, b_i),并将 aia_i 加到 xx 上、bib_i 加到 yy 上;而 Min 行动时,则可任选一对可用的 (cj, dj)(c_j,\, d_j),并从 xx 中减去 cjc_j、从 yy 中减去 djd_j。每只小猫在不同的回合中均可多次使用同一对整数。

Max 先手。若在某一时刻,两个数 xx 和 yy 同时为负,则 Min 获胜;否则,Max 获胜。假设双方均采取最优策略,请判断哪只小猫获胜。

输入格式

The first line contains two integers, n and m (1 ≤ n, m ≤ 100 000) — the number of pairs of numbers available to Max and Min, correspondingly.

The second line contains two integers x, y (1 ≤ x, y ≤ 109) — the initial values of numbers with which the kittens are playing.

Next n lines contain the pairs of numbers a__i, b__i (1 ≤ a__i, b__i ≤ 109) — the pairs available to Max.

The last m lines contain pairs of numbers c__j, d__j (1 ≤ c__j, d__j ≤ 109) — the pairs available to Min.

第一行包含两个整数 nn 和 mm(1≤n,m≤100 0001 \leq n, m \leq 100\,000),分别表示 Max 和 Min 可用的数对数量。

第二行包含两个整数 xx、yy(1≤x,y≤1091 \leq x, y \leq 10^9),表示小猫们初始所使用的两个数。

接下来的 nn 行,每行包含一对整数 ai, bia_i,\,b_i(1≤ai, bi≤1091 \leq a_i,\,b_i \leq 10^9),表示 Max 可用的数对。

最后的 mm 行,每行包含一对整数 cj, djc_j,\,d_j(1≤cj, dj≤1091 \leq c_j,\,d_j \leq 10^9),表示 Min 可用的数对。

输出格式

Print «Max» (without the quotes), if kitten Max wins, or "Min" (without the quotes), if kitten Min wins.

如果小猫 Max 获胜,则输出 «Max»(不带引号);如果小猫 Min 获胜,则输出 "Min"(不带引号)。

输入输出样例

  • 输入#1

    2 2
    42 43
    2 3
    3 2
    3 10
    10 3

    输出#1

    Min
  • 输入#2

    1 1
    1 1
    3 4
    1 1

    输出#2

    Max

说明/提示

In the first test from the statement Min can respond to move (2, 3) by move (3, 10), and to move (3, 2) by move (10, 3). Thus, for each pair of Max and Min's moves the values of both numbers x and y will strictly decrease, ergo, Min will win sooner or later.

In the second sample test after each pair of Max and Min's moves both numbers x and y only increase, thus none of them will become negative.

在题面给出的第一个测试用例中,Min 可以通过移动 (3,10)(3, 10) 来回应 Max 的移动 (2,3)(2, 3),并通过移动 (10,3)(10, 3) 来回应 Max 的移动 (3,2)(3, 2)。因此,对于 Max 和 Min 的每一对移动,两个数 xx 和 yy 的值都将严格减小,故 Min 终将获胜。

在第二个样例测试中,Max 和 Min 的每一对移动之后,两个数 xx 和 yy 都只会增大,因此它们均不会变为负数。

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

首页