Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

code3:RE 反正只是枚举,我随便交换点数都不行么?!!!

Posted by fzfzfz at 2015-01-12 11:50:43 on Problem 2960
In Reply To: 这神奇的机制,我也是醉了。下附三份代码,请君感受神奇的RE判定 Posted by:fzfzfz at 2015-01-12 11:47:39
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#define N 305
#define M 30100
using namespace std;
int S,s[N*100];
int sg[M];
int SG(int x)
{
	int i;
	if(sg[x]+1)return sg[x];
	bool vis[M<<1]={0};
	for(i=1;i<=S;i++)if(s[i]<=x)vis[SG(x-s[i])]=true;
	for(i=0;vis[i];i++);
	return sg[x]=i;
}
int n,m;
int main()
{
//	freopen("test.in","r",stdin);
	int i,j,k,g;
	while(scanf("%d",&S),S)// 数据组数A
	{
		for(i=1;i<=S;i++)scanf("%d",&s[i]); 
                int x,y;
		for(j=1;j<=100;++j){
                   x=rand()%S+1,y=rand()%S+1;swap(s[x],s[y]);
                }
			// s : 每次可以取的石子数量集合
		memset(sg,-1,sizeof(sg)),sg[0]=0;
		for(scanf("%d",&g);g--;) // 数据组数B
		{
			for(k=0,scanf("%d",&n);n--;) // n堆石子
			{
				scanf("%d",&m); // 该堆石子的个数
				k^=SG(m);
			}
			if(k)putchar('W');
			else putchar('L');
		}
		 puts("");
	}
	return 0;
}

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator