#include<iostream>
#include<cstdio>
#include<cstring>
#include<vector>
using namespace std;
int main(){
int n;//max
int a[],x[],vis[],sg[];
vector<char> c;
while(~scanf("%d",&n),n){
c.clear() ;
for(int i=;i<n;i++) scanf("%d",&a[i]);
int L;//heap
int ans=;
scanf("%d",&L);
for(int i=;i<L;i++){
int h;//bead
scanf("%d",&h);
sg[]=;
for(int j=;j<h;j++){
scanf("%d",&x[i]);
memset(vis,,sizeof(vis));
for(int k=;k<n;k++)
if(a[k]<=x[j])
vis[x[j]-a[k]]=;
for(int k=;;k++)
if(vis[k]==){
sg[j]=k;
break;
}
ans^=sg[j];
}
if(ans) c.push_back('W');
else c.push_back('L');
}
for(int i=;i<c.size() ;i++)
printf("%c",c[i]);
printf("\n");
}
}

S-Nim HDU - 1536的更多相关文章

  1. S-Nim HDU 1536 博弈 sg函数

    S-Nim HDU 1536 博弈 sg函数 题意 首先输入K,表示一个集合的大小,之后输入集合,表示对于这对石子只能去这个集合中的元素的个数,之后输入 一个m表示接下来对于这个集合要进行m次询问,之 ...

  2. HDU.1536.S-Nim(博弈论 Nim)

    题目链接 \(Description\) 给定一个集合S,每次只能拿S中某个元素个数的石子.每组数据有多组询问,询问给出m堆石子个数,问先手是否必胜.有多组数据. 1. 首先对操作数组排个序,再预处理 ...

  3. 【hdu 1536】S-Nim

    Time Limit: 5000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s) ...

  4. HDU 1536 & 1944

    http://acm.hdu.edu.cn/showproblem.php?pid=1536 http://acm.hdu.edu.cn/showproblem.php?pid=1944 一样的题 题 ...

  5. SG 函数初步 HDU 1536 &amp;&amp; HDU 1944

    题目链接:http://acm.hdu.edu.cn/showproblem.php? pid=1944 pid=1536"> http://acm.hdu.edu.cn/showpr ...

  6. HDU 1536 S-Nim SG博弈

    S-Nim Problem Description   Arthur and his sister Caroll have been playing a game called Nim for som ...

  7. HDU 1536 sg函数

    S-Nim Time Limit: 5000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submi ...

  8. Revenge of Nim hdu 4994 (博弈)

    http://acm.split.hdu.edu.cn/showproblem.php?pid=4994 题意:现在有两个人在取石子,共有n堆石子,每堆石子取完后才可以取下一堆石子,最后一个取石子的人 ...

  9. HDU 1536 sg-NIM博弈类

    题意:每次可以选择n种操作,玩m次,问谁必胜.c堆,每堆数量告诉. 题意:sg—NIM系列博弈模板题 把每堆看成一个点,求该点的sg值,异或每堆sg值. 将多维转化成一维,性质与原始NIM博弈一样. ...

  10. hdu 1536 SG函数模板题

    S-Nim Time Limit: 5000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Subm ...

随机推荐

  1. 在vim中 安装php的xdebug和 vdebug插件, 在vim中进行调试php代码

    在vim中 安装php的xdebug和 vdebug插件, 在vim中进行调试php代码 参考: http://www.cnblogs.com/qiantuwuliang/archive/2011/0 ...

  2. kubeadm 生成的token过期后,集群增加节点

    通过kubeadm初始化后,都会提供node加入的token: You should now deploy a pod network to the cluster. Run "kubect ...

  3. How to resize slide dimensions without resizing any objects on the slide?

    IF you are competent to unzip the pptx file and modify the XML it can be done, the slide size will c ...

  4. Windows,远程计算机:X.X.X.X,这可能是由于CredSSP加密Oracle修正

    https://blog.csdn.net/wyhwlls/article/details/80320301 近期window 10家庭版更新后,远程桌面连不到服务器了 网上有卸载补丁,修改组策略什么 ...

  5. Sample Classification Code of CIFAR-10 in Torch

    Sample Classification Code of CIFAR-10 in Torch from: http://torch.ch/blog/2015/07/30/cifar.html req ...

  6. 复习ing

    记不住啊,我能有什么办法,只好一遍又一遍看

  7. 51nod 1624 取余最长路

    http://www.51nod.com/onlineJudge/questionCode.html#!problemId=1624 题意: 思路:因为一共只有3行,所以只需要确定第一行和第二行的转折 ...

  8. snakemake使用笔记

    snakemake是一个用来编写任务流程的工具,用python编写的,因此其执行的流程脚本也比较通俗易懂,易于理解. 一.从一个简单的例子开始 1.安装snakemake 安装snakemake的方法 ...

  9. 将.db文件导入SQLServer2008数据库

    最近要做一个项目,需要连接数据库,给我的数据文件是sqlite,我需要将数据导入到SQLServer数据库 需要借助一个软件:DBDBMigration 页面最上方的选择框内,先选择数据文件类型,这里 ...

  10. win10上安装keras

    下载Anaconda https://www.anaconda.com/ 点击进入下载界面 选择Windows版本64位,python3.7 下载完成后 ,双击安装 等待安装完成! 安装MinGW包, ...