Roland
0
Q:

Koa the Koala and her best friend want to play a game. The game starts with an array a of length n consisting of non-negative integers. Koa and her best friend move in turns and each have initially a score equal to 0 . Koa starts.

#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <cmath>

using namespace std;

typedef long long ll;
const int maxn = 3e5 + 7;
const int INF = 2e9;

int a[maxn];

int main() {
    int T;scanf("%d",&T);
    while(T--) {
        int n;scanf("%d",&n);
        for(int i = 1;i <= n;i++) {
            scanf("%d",&a[i]);
        }
        int flag = 0;
        for(int i = 30;i >= 0;i--) {
            int cnt = 0;
            for(int j = 1;j <= n;j++) {
                if(a[j] & (1 << i)) {
                    cnt++;
                }
            }
            if(cnt % 2 == 1) {
                if(cnt % 4 == 1) {
                    flag = 1;
                } else {
                    if(n % 2 == 1) flag = -1;
                    else flag = 1;
                }
                break;
            }
        }
        if(flag == 1) {
            printf("WIN\n");
        } else if(flag == 0) {
            printf("DRAW\n");
        } else {
            printf("LOSE\n");
        }
    }
    return 0;
}

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
0

New to Communities?

Join the community