QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#318752 | #6552. Good and Lucky Matrices | socpite | 0 | 251ms | 4648kb | C++23 | 1.6kb | 2024-01-31 19:10:32 | 2024-01-31 19:10:33 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
bitset<2005> a[2005], b[2005];
int main(){
int t;
cin >> t;
while(t--){
string ty;
cin >> ty;
int n;
cin >> n;
for(int i = 0; i < n; i++){
for(int j = 0; j < n; j++){
char x;
cin >> x;
a[i].set(j, x=='1');
b[i].set(j, 0);
}
}
if(ty == "good"){
vector<int> vec;
for(int i = 0; i < n; i++){
vector<int> tmp(i, 0);
for(int j = 0; j < i; j++){
if(a[i][vec[j]]){
a[i]^=a[j];
tmp[j] = 1;
}
}
b[i] = a[i];
for(int j = 0; j < i; j++){
if(tmp[j])b[i].set(vec[j]);
}
assert(a[i]._Find_first() < n);
vec.push_back(a[i]._Find_first());
}
}
else{
vector<int> vec;
for(int i = 0; i < n; i++){
b[i] = a[i];
for(int j = 0; j < i; j++){
b[i].set(vec[j], 0);
}
for(int j = 0; j < i; j++){
if(a[i][vec[j]])b[i]^=b[j];
}
assert(b[i]._Find_first() < n);
vec.push_back(b[i]._Find_first());
}
}
cout << n << "\n";
for(int i = 0; i < n; i++){
for(int j = 0; j < n; j++)cout << b[i][j];
cout << "\n";
}
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3600kb
First Run Input
3 lucky 2 11 11 good 2 11 01 lucky 2 01 10
First Run Output
2 11 10 2 11 01 2 01 10
Second Run Input
3 good 2 11 10 lucky 2 11 01 good 2 01 10
Second Run Output
2 11 11 2 11 01 2 01 10
result:
ok 9 lines
Test #2:
score: 100
Accepted
time: 1ms
memory: 3588kb
First Run Input
3 good 2 11 10 lucky 2 11 01 good 2 01 10
First Run Output
2 11 11 2 11 01 2 01 10
Second Run Input
3 lucky 2 11 11 good 2 11 01 lucky 2 01 10
Second Run Output
2 11 10 2 11 01 2 01 10
result:
ok 9 lines
Test #3:
score: 100
Accepted
time: 251ms
memory: 4648kb
First Run Input
1 good 2000 100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
First Run Output
2000 1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
Second Run Input
1 lucky 2000 10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
Second Run Output
2000 1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
result:
ok 2001 lines
Test #4:
score: 100
Accepted
time: 237ms
memory: 4648kb
First Run Input
1 lucky 2000 10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
First Run Output
2000 1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
Second Run Input
1 good 2000 100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
Second Run Output
2000 1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
result:
ok 2001 lines
Test #5:
score: 100
Accepted
time: 241ms
memory: 4628kb
First Run Input
1 good 2000 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
First Run Output
2000 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
Second Run Input
1 lucky 2000 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
Second Run Output
2000 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
result:
ok 2001 lines
Test #6:
score: 100
Accepted
time: 248ms
memory: 4628kb
First Run Input
1 lucky 2000 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
First Run Output
2000 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
Second Run Input
1 good 2000 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
Second Run Output
2000 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
result:
ok 2001 lines
Test #7:
score: 0
Stage 1: Program answer Runtime Error
First Run Input
1 lucky 2000 11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...