QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#101612 | #6376. LaLa and Lamp | runewrz# | WA | 3ms | 12400kb | C++20 | 1.5kb | 2023-04-30 14:39:27 | 2023-04-30 14:39:30 |
Judging History
answer
#include<bits/stdc++.h>
#define rep(i,a,b) for (int i = (a); i <= (b); ++i)
#define drep(i,a,b) for (int i = (a); i >= (b); --i)
#define LL long long
#define ULL unsigned LL
using namespace std;
LL read() {
LL x = 0,y = 1; char ch = getchar(); while (!isdigit(ch)) {if (ch == '-') y = -y; ch = getchar();}
while (isdigit(ch)) {x = x*10+ch-'0'; ch = getchar();} return x*y;
}
namespace qiqi {
const int N = 1005,M = N*N/2,w = 64; int n,cnt,id[N][N],num,p[N][N]; char str[N];
struct BS {
static const int n = M/w+1; ULL a[M/w+5];
void upd (ULL p,int k = 1) {
ULL x = p/w,y = p%w;
if (k) a[x] |= 1<<y;
else {
a[x] ^= a[x]&(1<<y);
}
}
int find() {
drep(i,n,0) if (a[i]) {
return __lg(a[i])+i*w;
}
return -1;
}
void cal(BS &k) {
rep(i,0,n) a[i] ^= k.a[i];
}
} f[N*3],a;
void main() {
n = read();
drep(i,n,1) drep(j,i,1) id[i][j] = ++cnt;
rep(i,1,n) {
p[i][1] = ++num;
rep(j,1,i) f[num].upd(id[i][j]);
if (i > 1) {
p[i][2] = ++num;
if (p[i-1][2]) {
f[num] = f[p[i-1][2]];
}
rep(j,2,i-1) f[num].upd(id[i-1][j],0);
rep(j,i,n) f[num].upd(id[j][j-i+2]);
}
if (i > 2) {
p[i][i] = ++num;
rep(j,i,n) f[num].upd(id[j][i]);
}
}
rep(i,1,n) {
scanf("%s",str+1);
rep(j,1,i) {
if (str[j]-'0') a.upd(id[i][j]);
}
}
rep(i,1,num) {
if (a.find() == f[i].find()) a.cal(f[i]);
}
puts(a.find() == -1 ? "Yes" : "No");
}
}
int main() {
qiqi::main(); return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 3ms
memory: 7872kb
input:
6 0 00 000 0110 00100 000000
output:
Yes
result:
ok answer is YES
Test #2:
score: 0
Accepted
time: 3ms
memory: 7784kb
input:
2 0 11
output:
Yes
result:
ok answer is YES
Test #3:
score: 0
Accepted
time: 3ms
memory: 7676kb
input:
3 1 10 011
output:
Yes
result:
ok answer is YES
Test #4:
score: 0
Accepted
time: 3ms
memory: 7784kb
input:
4 1 11 101 0101
output:
No
result:
ok answer is NO
Test #5:
score: 0
Accepted
time: 1ms
memory: 9652kb
input:
5 0 11 010 0011 11100
output:
No
result:
ok answer is NO
Test #6:
score: 0
Accepted
time: 1ms
memory: 9616kb
input:
6 0 10 100 1011 00001 010101
output:
No
result:
ok answer is NO
Test #7:
score: 0
Accepted
time: 3ms
memory: 7984kb
input:
7 0 01 101 0010 11000 010100 0111101
output:
No
result:
ok answer is NO
Test #8:
score: 0
Accepted
time: 3ms
memory: 9836kb
input:
8 0 01 100 1111 10011 001010 1000010 00001101
output:
No
result:
ok answer is NO
Test #9:
score: 0
Accepted
time: 1ms
memory: 9676kb
input:
9 1 00 111 0000 11110 100011 0100101 01010001 010111101
output:
No
result:
ok answer is NO
Test #10:
score: 0
Accepted
time: 1ms
memory: 10060kb
input:
10 1 01 011 1101 01011 000111 1111000 11111111 000010010 0011001100
output:
No
result:
ok answer is NO
Test #11:
score: 0
Accepted
time: 0ms
memory: 12400kb
input:
11 1 11 001 0001 00011 111000 1101001 10100101 100111110 1000001011 11110011111
output:
No
result:
ok answer is NO
Test #12:
score: -100
Wrong Answer
time: 0ms
memory: 9644kb
input:
12 0 01 111 0101 01110 011000 1001010 10010001 011011000 1110110101 10101101110 111100100111
output:
No
result:
wrong answer expected YES, found NO