CF335C.More Reclamation
提高+/省选-
通过率:0%
时间限制:2.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
In a far away land, there are two cities near a river. One day, the cities decide that they have too little space and would like to reclaim some of the river area into land.
The river area can be represented by a grid with r rows and exactly two columns — each cell represents a rectangular area. The rows are numbered 1 through r from top to bottom, while the columns are numbered 1 and 2.
Initially, all of the cells are occupied by the river. The plan is to turn some of those cells into land one by one, with the cities alternately choosing a cell to reclaim, and continuing until no more cells can be reclaimed.
However, the river is also used as a major trade route. The cities need to make sure that ships will still be able to sail from one end of the river to the other. More formally, if a cell (r, c) has been reclaimed, it is not allowed to reclaim any of the cells (r - 1, 3 - c), (r, 3 - c), or (r + 1, 3 - c).
The cities are not on friendly terms, and each city wants to be the last city to reclaim a cell (they don't care about how many cells they reclaim, just who reclaims a cell last). The cities have already reclaimed n cells. Your job is to determine which city will be the last to reclaim a cell, assuming both choose cells optimally from current moment.
在一片遥远的土地上,有两座城市毗邻一条河流。某天,这两座城市意识到自身可用空间不足,决定将部分河域填为陆地。
河域可用一个具有 r 行、恰好两列的网格表示——每个格子代表一块矩形区域。行号从上到下依次为 1 至 r,列号为 1 和 2。
初始时,所有格子均被河水占据。规划是逐个将其中一些格子填为陆地:两座城市轮流选择一个格子进行填海,直至无法再填海为止。
然而,该河流也是一条重要的贸易航道。两座城市必须确保船只仍能从河的一端顺利航行至另一端。更准确地说,若格子 (r,c) 已被填为陆地,则禁止再填以下任意格子:(r−1,3−c)、(r,3−c) 或 (r+1,3−c)。
这两座城市关系并不友好,各自的目标都是成为最后一个填海的城市(它们并不在意自己总共填了多少格子,只关心谁执行最后一次填海操作)。目前,两座城市已共同完成了 n 次填海操作。你的任务是:假设双方从此刻起均采取最优策略,判断最终将是哪座城市执行最后一次填海操作。
输入格式
The first line consists of two integers r and n (1 ≤ r ≤ 100, 0 ≤ n ≤ r). Then n lines follow, describing the cells that were already reclaimed. Each line consists of two integers: r__i and c__i (1 ≤ r__i ≤ r, 1 ≤ c__i ≤ 2), which represent the cell located at row r__i and column c__i. All of the lines describing the cells will be distinct, and the reclaimed cells will not violate the constraints above.
第一行包含两个整数 r 和 n(1≤r≤100,0≤n≤r)。随后是 n 行,描述已被开垦的单元格。每行包含两个整数:ri 和 ci(1≤ri≤r,1≤ci≤2),表示位于第 ri 行、第 ci 列的单元格。所有描述单元格的行互不相同,且已开垦的单元格均满足上述约束条件。
输出格式
Output "WIN" if the city whose turn it is to choose a cell can guarantee that they will be the last to choose a cell. Otherwise print "LOSE".
如果轮到选择格子的城市能够保证自己是最后一个选择格子的城市,则输出 "WIN";否则输出 "LOSE"。
输入输出样例
输入#1
3 1 1 1
输出#1
WIN
输入#2
12 2 4 1 8 1
输出#2
WIN
输入#3
1 1 1 2
输出#3
LOSE
说明/提示
In the first example, there are 3 possible cells for the first city to reclaim: (2, 1), (3, 1), or (3, 2). The first two possibilities both lose, as they leave exactly one cell for the other city.

However, reclaiming the cell at (3, 2) leaves no more cells that can be reclaimed, and therefore the first city wins.

In the third example, there are no cells that can be reclaimed.
在第一个例子中,第一座城市可收复的格子有 3 个可能选择:(2,1)、(3,1) 或 (3,2)。前两种选择均会导致失败,因为它们恰好为另一座城市留下一个可收复的格子。

然而,若收复 (3,2) 处的格子,则不再存在任何可被收复的格子,因此第一座城市获胜。

在第三个例子中,不存在任何可被收复的格子。
输入解题思路,AI测评打分。不知道怎么写?