QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#342284 | #313. Equation Mod 2 | fjashufi_1 | RE | 0ms | 0kb | C++14 | 1.4kb | 2024-03-01 10:20:27 | 2024-03-01 10:20:27 |
answer
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <bitset>
#include <iostream>
#include <vector>
#include <queue>
using namespace std;
#define PII pair<int,int>
#define x first
#define y second
#define For(i, l, r) for(int i = l; i <= r; i ++)
#define Rep(i, l, r) for(int i = l; i >= r; i --)
bool START;
void in(int &x)
{
char c = getchar();
while(c > '9' || c < '0') c = getchar();
for(x = 0; c >= '0' && c <= '9'; c = getchar())
x = x * 10 + c - '0';
}
const int N = 5010;
int n, m;
bitset<N> a[N], now;
int cc[N];
void Out()
{
For(i, 1, n)
{
For(j, 1, n + 1) printf("%d ", 0+a[i][j]); puts("");
}
puts("-----------------");
}
bool ENDPOS = 0;
int main()
{
freopen("pub.in", "r", stdin);
freopen("pub.out", "w", stdout);
in(n); in(m);
For(j, 1, m)
{
int xx;
For(i, 1, n + 1)
{
in(xx); a[j][i] = xx;
}
}
int r = 1;
For(c, 1, n)
{
int t = r;
// printf("c = %d, r = %d\n", c, r);
For(i, r + 1, m) if(a[i][c]) {t = i; break;}
if(!a[t][c]) continue;
swap(a[r], a[t]);
For(i, 1, m)
{
if(i == r) continue;
if(!a[i][c]) continue;
a[i] ^= a[r];
}
cc[c] = r;
r ++;
// Out();
}
For(i, 1, n) if(cc[i])
{
if(a[cc[i]][n + 1]) printf("1 ");
else printf("0 ");
}
else printf("0 ");
// For(i, 1, n) printf("%d ", (int)a[i][n + 1]);
cerr << (&ENDPOS - &START) * 1.0 / 1024 / 1024 << endl; return 0;
}
详细
Test #1:
score: 0
Dangerous Syscalls
input:
100 95 0 0 0 1 1 0 1 1 1 0 0 1 0 1 1 0 0 1 1 0 1 0 1 0 0 0 1 1 0 1 1 1 0 1 0 1 0 0 0 0 1 0 0 0 1 1 0 1 1 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 0 1 1 1 1 0 0 0 0 1 1 0 1 1 1 0 0 0 0 1 0 1 1 1 1 1 0 0 1 0 1 1 0 1 0 1 0 0 0 1 0 0 1 1 0 0 0 0 1 0 0 1 1 0 1 0 0 0 0 0 0 0 1 1 1 1 0 1 0 1 1 0 0 0 1 1 0 0 1 1 0 1...