Berzerk

题意翻译

## 题目描述 Rick 和 Morty 在玩一个版本的 Berzerk 游戏。这个游戏需要很大的空间,所以他们使用电脑玩这个游戏。 游戏中有 $n$ 个标号从 $1 \sim n$ 的物体围成一个圆圈(顺时针标号), 物体 $1$ 表示黑洞,其它物体表示星 球,且某一个星球上有一个怪物,Rick 和 Morty 不知道这个怪物在哪个星球上,只知道这个怪物在游 戏开始时没有进入黑洞。但就目前而言,他们希望为每种可能的情况做好准备。 Rick 和 Monty 每人有一个数的集合,集合中的数在 $[1,n-1]$ 之间。Rick 的集合是 $s_1$,其中有 $k_1$ 个 数,Morty 的集合是 $s_2$,其中有 $k_2$ 个数。游戏开始后,两人轮流操作。在操作中,玩家必须从他的集 合中选出一个数 $x$,怪物将从当前位置顺时针移动 $x$ 个位置,如果怪物移动后进入了黑洞,则该玩家获胜。 你的任务是对于每一个怪物的位置以及玩家先后手顺序,判断游戏先手获胜、后手获胜、无限循环。(每个玩家都采取最优操作) ## 输入格式 输入的第一行包含一个整数 $n(2 \leq n \leq 7000)$。 第二行包含整数 $k_1$,后跟 $k_1$ 个不同的整数 $s_{1,1},s_{1,2},...,s_{1,k_1}$(Rick的集合) 第三行包含整数 $k_2$,后跟 $k_2$ 个不同的整数 $s_{2,1},s_{2,2},...,s_{2,k_2}$(Morty的集合) $1\leq k_1,k_2 \leq n - 1,1\leq s_{i,1}, s_{i,2},...,s_{i,k_i} (1 \leq i \leq 2)$ ## 输出格式 对于每一个怪物的位置以及玩家先后手顺序,如果 Rick 赢则输出 `Win`,输则输出 `Lose`,无限循环则输出`Loop`。

题目描述

Rick and Morty are playing their own version of Berzerk (which has nothing in common with the famous Berzerk game). This game needs a huge space, so they play it with a computer. In this game there are $ n $ objects numbered from $ 1 $ to $ n $ arranged in a circle (in clockwise order). Object number $ 1 $ is a black hole and the others are planets. There's a monster in one of the planet. Rick and Morty don't know on which one yet, only that he's not initially in the black hole, but Unity will inform them before the game starts. But for now, they want to be prepared for every possible scenario. ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF786A/4581566160d89c6e337f9c80481a09310fbff76c.png)Each one of them has a set of numbers between $ 1 $ and $ n-1 $ (inclusive). Rick's set is $ s_{1} $ with $ k_{1} $ elements and Morty's is $ s_{2} $ with $ k_{2} $ elements. One of them goes first and the player changes alternatively. In each player's turn, he should choose an arbitrary number like $ x $ from his set and the monster will move to his $ x $ -th next object from its current position (clockwise). If after his move the monster gets to the black hole he wins. Your task is that for each of monster's initial positions and who plays first determine if the starter wins, loses, or the game will stuck in an infinite loop. In case when player can lose or make game infinity, it more profitable to choose infinity game.

输入输出格式

输入格式


The first line of input contains a single integer $ n $ ( $ 2<=n<=7000 $ ) — number of objects in game. The second line contains integer $ k_{1} $ followed by $ k_{1} $ distinct integers $ s_{1,1},s_{1,2},...,s_{1,k1} $ — Rick's set. The third line contains integer $ k_{2} $ followed by $ k_{2} $ distinct integers $ s_{2,1},s_{2,2},...,s_{2,k2} $ — Morty's set $ 1<=k_{i}<=n-1 $ and $ 1<=s_{i,1},s_{i,2},...,s_{i,ki}<=n-1 $ for $ 1<=i<=2 $ .

输出格式


In the first line print $ n-1 $ words separated by spaces where $ i $ -th word is "Win" (without quotations) if in the scenario that Rick plays first and monster is initially in object number $ i+1 $ he wins, "Lose" if he loses and "Loop" if the game will never end. Similarly, in the second line print $ n-1 $ words separated by spaces where $ i $ -th word is "Win" (without quotations) if in the scenario that Morty plays first and monster is initially in object number $ i+1 $ he wins, "Lose" if he loses and "Loop" if the game will never end.

输入输出样例

输入样例 #1

5
2 3 2
3 1 2 3

输出样例 #1

Lose Win Win Loop
Loop Win Win Win

输入样例 #2

8
4 6 2 3 4
2 3 6

输出样例 #2

Win Win Win Win Win Win Win
Lose Win Lose Lose Win Lose Lose