CF1383B.GameGame

普及+/提高

通过率:0%

时间限制:1.00s

内存限制:256MB

AC君温馨提醒

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

题目描述

Koa the Koala and her best friend want to play a game.

The game starts with an array aa of length nn consisting of non-negative integers. Koa and her best friend move in turns and each have initially a score equal to 00. Koa starts.

Let's describe a move in the game:

  • During his move, a player chooses any element of the array and removes it from this array, xor-ing it with the current score of the player.

    More formally: if the current score of the player is xx and the chosen element is yy, his new score will be x⊕yx \oplus y. Here ⊕\oplus denotes bitwise XOR operation.

    Note that after a move element yy is removed from aa.

  • The game ends when the array is empty.

At the end of the game the winner is the player with the maximum score. If both players have the same score then it's a draw.

If both players play optimally find out whether Koa will win, lose or draw the game.

考拉Koa和她最好的朋友想玩一个游戏。

游戏开始时有一个长度为 nn 的数组 aa,其中所有元素均为非负整数。Koa和她最好的朋友轮流进行操作,两人初始得分均为 00,Koa先手。

下面我们描述一次操作的规则:

  • 在一名玩家的操作中,他需从数组中任选一个元素并将其移除,并将该元素与自己当前得分作异或运算。

    更准确地说:若该玩家当前得分为 xx,所选元素为 yy,则其新得分为 x⊕yx \oplus y。此处 ⊕\oplus 表示按位异或运算。

    注意:操作完成后,元素 yy 将从数组 aa 中被移除。

  • 当数组为空时,游戏结束。

游戏结束后,得分更高的玩家获胜;若双方得分相同,则为平局。

假设双方均以最优策略进行游戏,请判断Koa最终会获胜、失败还是平局。

输入格式

Each test contains multiple test cases. The first line contains tt (1≤t≤1041 \le t \le 10^4) — the number of test cases. Description of the test cases follows.

The first line of each test case contains the integer nn (1≤n≤1051 \le n \le 10^5) — the length of aa.

The second line of each test case contains nn integers a1,a2,…,ana_1, a_2, \ldots, a_n (0≤ai≤1090 \le a_i \le 10^9) — elements of aa.

It is guaranteed that the sum of nn over all test cases does not exceed 10510^5.

每个测试包含多个测试用例。第一行包含 tt(1≤t≤1041 \le t \le 10^4)—— 测试用例的数量。随后是各测试用例的描述。

每个测试用例的第一行包含整数 nn(1≤n≤1051 \le n \le 10^5)—— 数组 aa 的长度。

每个测试用例的第二行包含 nn 个整数 a1,a2,…,ana_1, a_2, \ldots, a_n(0≤ai≤1090 \le a_i \le 10^9)—— 数组 aa 的元素。

保证所有测试用例的 nn 之和不超过 10510^5。

输出格式

For each test case print:

  • WIN if Koa will win the game.
  • LOSE if Koa will lose the game.
  • DRAW if the game ends in a draw.

对于每个测试用例,输出:

  • 若 Koa 将赢得游戏,输出 WIN;
  • 若 Koa 将输掉游戏,输出 LOSE;
  • 若游戏以平局结束,输出 DRAW。

输入输出样例

  • 输入#1

    3
    3
    1 2 2
    3
    2 2 3
    5
    0 0 0 2 2

    输出#1

    WIN
    LOSE
    DRAW
  • 输入#2

    4
    5
    4 1 5 1 3
    4
    1 0 1 6
    1
    0
    2
    5 4

    输出#2

    WIN
    WIN
    DRAW
    WIN

说明/提示

In testcase 11 of the first sample we have:

a=[1,2,2]a = [1, 2, 2]. Here Koa chooses 11, other player has to choose 22, Koa chooses another 22. Score for Koa is 1⊕2=31 \oplus 2 = 3 and score for other player is 22 so Koa wins.

在第一个样例的测试用例 11 中,我们有:

a=[1,2,2]a = [1, 2, 2]。此处 Koa 选择 11,另一名玩家必须选择 22,Koa 再选择另一个 22。Koa 的得分为 1⊕2=31 \oplus 2 = 3,另一名玩家的得分为 22,因此 Koa 获胜。

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

首页