QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#188457#7303. City UnitedzhouhuanyiWA 1ms4272kbC++14695b2023-09-25 20:52:582023-09-25 20:52:58

Judging History

你现在查看的是最新测评结果

  • [2023-09-25 20:52:58]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:4272kb
  • [2023-09-25 20:52:58]
  • 提交

answer

#include<iostream>
#include<cstdio>
#define N 50
#define M 13
using namespace std;
int read()
{
	char c=0;
	int sum=0;
	while (c<'0'||c>'9') c=getchar();
	while ('0'<=c&&c<='9') sum=sum*10+c-'0',c=getchar();
	return sum;
}
int n,m,ans,st[N+1],dp[N+1][1<<M];
int main()
{
	int x,y;
	n=read(),m=read();
	for (int i=1;i<=m;++i)
	{
		x=read(),y=read();
		if (x>y) swap(x,y);
		st[y]|=(1<<(y-x-1));
	}
	dp[0][0]=1;
	for (int i=1;i<=n;++i)
		for (int j=0;j<(1<<13);++j)
		{
			dp[i][(j<<1)&((1<<13)-1)]^=dp[i-1][j];
			if (!(j&st[i])) dp[i][((j<<1)&((1<<13)-1))|1]^=dp[i-1][j];
		}
	for (int i=0;i<(1<<13);++i) ans^=dp[n][i];
	printf("%d\n",ans^(n&1));
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 3712kb

input:

3 2
1 2
2 3

output:

0

result:

ok 1 number(s): "0"

Test #2:

score: 0
Accepted
time: 1ms
memory: 3656kb

input:

3 3
1 2
2 3
3 1

output:

1

result:

ok 1 number(s): "1"

Test #3:

score: -100
Wrong Answer
time: 1ms
memory: 4272kb

input:

15 31
9 5
14 5
2 7
5 15
11 14
11 9
2 6
3 4
12 1
6 8
3 5
11 10
15 6
4 1
1 2
8 9
6 12
14 10
13 2
4 5
3 8
3 15
11 6
7 5
4 6
11 2
13 15
3 2
8 4
6 13
7 10

output:

0

result:

wrong answer 1st numbers differ - expected: '1', found: '0'