mirror of
https://git.sb/baoshuo/OI-codes.git
synced 2024-11-23 20:48:48 +00:00
parent
b8ff265849
commit
0dae9844f1
96
S2OJ/1909/1909.cpp
Normal file
96
S2OJ/1909/1909.cpp
Normal 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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
BIN
S2OJ/1909/data/problem.conf
(Stored with Git LFS)
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user