# codeforces736D. Permutations(线性代数)

## Sol

#include<cstdio>
#include<bitset>
#include<iostream>
using namespace std;
const int MAXN = 2001;
char c = getchar(); int x = 0, f = 1;
while(c < '0' || c > '9') {if(c == '-') f = -1; c = getchar();}
while(c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
return x * f;
}
int N, M;
bitset<MAXN * 2 + 10> b[MAXN];
int x[500001], y[500001];
int main() {
for(int i = 1; i <= N; i++) b[i][i + N] = 1;
for(int i = 1; i <= M; i++) {
b[x[i]][y[i]] = 1;
}
for(int i = 1, j; i <= N; i++) {
for(j = i; j <= N; j++) if(b[j][i]) {swap(b[i], b[j]); break;}
for(int k = 1; k <= N; k++)
if(b[k][i] && (k != i)) b[k] ^= b[i];
}
for(int i = 1; i <= N; i++, puts(""))
for(int j = 1; j <= 2 * N; j++)
cout << b[i][j] << " ";
return 0;
}
/*
3 7
1 1
1 3
2 2
2 3
3 1
3 2
3 3

*/

1811 篇文章114 人订阅

0 条评论

## 相关文章

661

1572

### [翻译]CURAND Libaray--Host API--(2)

2.3 返回值 所有的CURAND host端的函数返回值都是curandStatus_t.如果调用没有错误，则返回成功，即返回值为CURAND_STATUS_...

22410

1995

561

1721

710

1043

1791

1165