CF566G.Max and Min

普及/提高-

通过率:0%

AC君温馨提醒

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

题目描述

Two kittens, Max and Min, play with a pair of non-negative integers xx and yy . 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, xx and yy 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 nn pairs of non-negative integers (ai,bi)(a_{i},b_{i}) ( 1<=i<=n1<=i<=n ), and kitten Min has mm pairs of non-negative integers (cj,dj)(c_{j},d_{j}) ( 1<=j<=m1<=j<=m ). As kitten Max makes a move, it can take any available pair (ai,bi)(a_{i},b_{i}) and add aia_{i} to xx and bib_{i} to yy , and kitten Min can take any available pair (cj,dj)(c_{j},d_{j}) and subtract cjc_{j} from xx and djd_{j} from yy . Each kitten can use each pair multiple times during distinct moves.

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

输入格式

The first line contains two integers, nn and mm ( 1<=n,m<=1000001<=n,m<=100000 ) — the number of pairs of numbers available to Max and Min, correspondingly.

The second line contains two integers xx , yy ( 1<=x,y<=1091<=x,y<=10^{9} ) — the initial values of numbers with which the kittens are playing.

Next nn lines contain the pairs of numbers ai,bia_{i},b_{i} ( 1<=ai,bi<=1091<=a_{i},b_{i}<=10^{9} ) — the pairs available to Max.

The last mm lines contain pairs of numbers cj,djc_{j},d_{j} ( 1<=cj,dj<=1091<=c_{j},d_{j}<=10^{9} ) — the pairs available to Min.

输出格式

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

输入输出样例

  • 输入#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)(2,3) by move (3,10)(3,10) , and to move (3,2)(3,2) by move (10,3)(10,3) . Thus, for each pair of Max and Min's moves the values of both numbers xx and yy 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 xx and yy only increase, thus none of them will become negative.

首页