QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#677037#313. Equation Mod 2ArgharizaWA 1ms3992kbC++171.2kb2024-10-26 08:47:302024-10-26 08:47:31

Judging History

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

  • [2024-10-26 08:47:31]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3992kb
  • [2024-10-26 08:47:30]
  • 提交

answer

#include <bits/stdc++.h>
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define F(i, x, y) for (int i = (x); i <= (y); i++)
#define R(i, x, y) for (int i = (x); i >= (y); i--)
#define FIO(FILE) freopen(FILE".in", "r", stdin), freopen(FILE".out", "w", stdout)

using namespace std;
typedef long long ll;
typedef pair<int, int> pi;
bool Mbe;

const int N = 5e3 + 5;

int n, m, ans[N];
bitset<N> A[N];

void Gauss() {
	F (i, 1, n) {
		int p = -1;
		F (j, i, m) {
			if (A[j][i]) {
				p = j;
				break;
			}
		}
		if (!~p) {
			ans[i] = 0;
			continue;
		}
		if (p != i) {
			swap(A[i], A[p]);
		}
		F (j, 1, m) {
			if (i == j) {
				continue;
			}
			if (A[j][i]) {
				A[j] ^= A[i];
			}
		}
	}
}

void solve() {
	cin >> n >> m;
	F (i, 1, m) {
		F (j, 1, n + 1) {
			int x;
			cin >> x;
			A[i][j] = x;
		}
	}
	Gauss();
	F (i, 1, n) {
		cout << A[i][n + 1] << ' ';
	}
}

bool Med;
int main() {
	// FIO("");
	ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	cerr << (&Mbe - &Med) / 1048576.0 << " MB\n";
	int T = 1;
	// cin >> T;
	while (T--) solve();
	cerr << (int)(1e3 * clock() / CLOCKS_PER_SEC) << " ms\n";
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 3992kb

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