0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-11-23 18:28:47 +00:00
https://sjzezoj.com/submission/69017
This commit is contained in:
Baoshuo Ren 2023-02-10 21:10:47 +08:00
parent b8ff265849
commit 0dae9844f1
Signed by: baoshuo
GPG Key ID: 00CB9680AB29F51A
24 changed files with 165 additions and 0 deletions

96
S2OJ/1909/1909.cpp Normal file
View File

@ -0,0 +1,96 @@
#include <iostream>
#include <vector>
using std::cin;
using std::cout;
const char endl = '\n';
const int N = 2005;
int n, a[N][N];
int gauss() {
int c, r;
for (c = r = 1; c <= n; c++) {
int t = r;
for (int i = r; i <= n; i++) {
if (a[i][c]) t = i;
}
if (!a[t][c]) continue;
std::swap(a[t], a[r]);
for (int i = r + 1; i <= n; i++) {
if (a[i][c]) {
for (int j = n + 1; j >= c; j--) {
a[i][j] ^= a[r][j];
}
}
}
r++;
}
if (r <= n) {
for (int i = r; i <= n; i++) {
if (a[i][n + 1]) {
return -1;
}
}
}
for (int i = n; i; i--) {
for (int j = i + 1; j <= n; j++) {
a[i][n + 1] ^= a[i][j] & a[j][n + 1];
}
}
return 0;
}
int main() {
std::ios::sync_with_stdio(false);
cin.tie(nullptr);
cin >> n;
for (int i = 1, k; i <= n; i++) {
cin >> k;
for (int j = 1, x; j <= k; j++) {
cin >> x;
a[i][x] = 1;
}
if (k % 2) {
a[i][i] = 1;
a[i][n + 1] = 1;
}
}
if (gauss() != 0) {
cout << -1 << endl;
} else {
std::vector<int> ans;
for (int i = 1; i <= n; i++) {
if (a[i][n + 1]) {
ans.push_back(i);
}
}
cout << ans.size() << endl;
for (int x : ans) {
cout << x << ' ';
}
cout << endl;
}
return 0;
}

BIN
S2OJ/1909/data/gua1.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1909/data/gua1.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1909/data/gua10.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1909/data/gua10.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1909/data/gua11.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1909/data/gua11.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1909/data/gua2.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1909/data/gua2.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1909/data/gua3.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1909/data/gua3.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1909/data/gua4.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1909/data/gua4.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1909/data/gua5.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1909/data/gua5.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1909/data/gua6.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1909/data/gua6.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1909/data/gua7.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1909/data/gua7.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1909/data/gua8.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1909/data/gua8.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1909/data/gua9.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1909/data/gua9.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1909/data/problem.conf (Stored with Git LFS) Normal file

Binary file not shown.