QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#469665#6376. LaLa and Lampcppcppcpp3WA 1ms5876kbC++14917b2024-07-09 21:37:212024-07-09 21:37:21

Judging History

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

  • [2024-07-09 21:37:21]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:5876kb
  • [2024-07-09 21:37:21]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
const int N=2005;

int n,cnt,a[N][N];
char s[N];
bitset<4001> b[N<<1];

bool calc(int n,int m){
	for(int i=0;i<n;++i){
		int cur=i;
		while(cur<m && !b[cur][i]) ++cur;
		if(cur==m) continue;
		if(cur^i) swap(b[i],b[cur]);
		for(int j=0;j<m;++j) if(i^j && b[j][i]) b[j]^=b[i];
	}
	for(int i=0;i<m;++i){
		int tt=0;
		for(int j=0;j<n;++j) tt+=b[i][j];
		if(tt==1 && !b[i][n]) return 0;
	}
	return 1;
}

signed main(){
	scanf("%d",&n);
	for(int i=0;i<n;++i){
		scanf("%s",s);
		for(int j=0;j<=i;++j) a[i][j]=s[j]-48;
	}
	for(int p=0;p<2;++p){
		for(int q=0;q<2;++q){
			cnt=0;
			for(int i=0;i<n-1;++i){
				b[++cnt][2*n]=p^a[n-2][i];
				b[cnt][i]=1,b[cnt][i+n+1]=1;
			}
			for(int i=0;i<n;++i){
				b[++cnt][2*n]=q^a[n-1][i];
				b[cnt][i]=1,b[cnt][i+n]=1;
			}
			if(calc(2*n,2*n-1)) puts("Yes"),exit(0);
		}
	}
	puts("No");
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

6
0
00
000
0110
00100
000000

output:

Yes

result:

ok answer is YES

Test #2:

score: 0
Accepted
time: 0ms
memory: 3592kb

input:

2
0
11

output:

Yes

result:

ok answer is YES

Test #3:

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

input:

3
1
10
011

output:

Yes

result:

ok answer is YES

Test #4:

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

input:

4
1
11
101
0101

output:

Yes

result:

wrong answer expected NO, found YES