QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#469665 | #6376. LaLa and Lamp | cppcppcpp3 | WA | 1ms | 5876kb | C++14 | 917b | 2024-07-09 21:37:21 | 2024-07-09 21:37:21 |
Judging History
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");
}
詳細信息
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