QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#342284#313. Equation Mod 2fjashufi_1RE 0ms0kbC++141.4kb2024-03-01 10:20:272024-03-01 10:20:27

Judging History

你现在查看的是最新测评结果

  • [2024-03-01 10:20:27]
  • 评测
  • 测评结果:RE
  • 用时:0ms
  • 内存:0kb
  • [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;
}

Details

Tip: Click on the bar to expand more detailed information

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...

output:


result: