mirror of
https://git.sb/baoshuo/OI-codes.git
synced 2024-11-23 18:28:47 +00:00
parent
95ce0ec323
commit
66970b14d9
88
S2OJ/1564/1564.cpp
Normal file
88
S2OJ/1564/1564.cpp
Normal file
@ -0,0 +1,88 @@
|
||||
#include <iostream>
|
||||
#include <algorithm>
|
||||
#include <numeric>
|
||||
#include <vector>
|
||||
|
||||
using std::cin;
|
||||
using std::cout;
|
||||
const char endl = '\n';
|
||||
|
||||
const int N = 2e5 + 5;
|
||||
|
||||
int n, m;
|
||||
bool vis[N];
|
||||
std::vector<int> g[N], a, b;
|
||||
|
||||
void check() {
|
||||
if (a.size() == n - a.size() - b.size()) {
|
||||
std::fill_n(vis, N, false);
|
||||
|
||||
cout << b.size() << ' ' << a.size() << endl;
|
||||
|
||||
for (const int &x : b) {
|
||||
cout << x << ' ';
|
||||
|
||||
vis[x] = true;
|
||||
}
|
||||
|
||||
cout << endl;
|
||||
|
||||
for (const int &x : a) {
|
||||
cout << x << ' ';
|
||||
|
||||
vis[x] = true;
|
||||
}
|
||||
|
||||
cout << endl;
|
||||
|
||||
for (int i = 1; i <= n; i++) {
|
||||
if (!vis[i]) {
|
||||
cout << i << ' ';
|
||||
}
|
||||
}
|
||||
|
||||
cout << endl;
|
||||
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
|
||||
void dfs(int u) {
|
||||
vis[u] = true;
|
||||
b.emplace_back(u);
|
||||
check();
|
||||
|
||||
for (const int &v : g[u]) {
|
||||
if (vis[v]) continue;
|
||||
|
||||
dfs(v);
|
||||
check();
|
||||
}
|
||||
|
||||
b.pop_back();
|
||||
a.emplace_back(u);
|
||||
}
|
||||
|
||||
int main() {
|
||||
std::ios::sync_with_stdio(false);
|
||||
cin.tie(nullptr);
|
||||
|
||||
cin >> n >> m;
|
||||
|
||||
for (int i = 1; i <= m; i++) {
|
||||
int u, v;
|
||||
|
||||
cin >> u >> v;
|
||||
|
||||
g[u].emplace_back(v);
|
||||
g[v].emplace_back(u);
|
||||
}
|
||||
|
||||
for (int i = 1; i <= n; i++) {
|
||||
if (!vis[i]) dfs(i);
|
||||
}
|
||||
|
||||
cout << -1 << endl;
|
||||
|
||||
return 0;
|
||||
}
|
BIN
S2OJ/1564/data/chk.cpp
(Stored with Git LFS)
Normal file
BIN
S2OJ/1564/data/chk.cpp
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1564/data/king1.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1564/data/king1.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1564/data/king1.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1564/data/king1.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1564/data/king10.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1564/data/king10.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1564/data/king10.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1564/data/king10.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1564/data/king11.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1564/data/king11.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1564/data/king11.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1564/data/king11.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1564/data/king12.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1564/data/king12.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1564/data/king12.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1564/data/king12.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1564/data/king13.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1564/data/king13.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1564/data/king13.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1564/data/king13.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1564/data/king14.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1564/data/king14.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1564/data/king14.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1564/data/king14.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1564/data/king15.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1564/data/king15.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1564/data/king15.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1564/data/king15.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1564/data/king16.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1564/data/king16.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1564/data/king16.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1564/data/king16.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1564/data/king17.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1564/data/king17.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1564/data/king17.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1564/data/king17.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1564/data/king18.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1564/data/king18.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1564/data/king18.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1564/data/king18.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1564/data/king19.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1564/data/king19.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1564/data/king19.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1564/data/king19.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1564/data/king2.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1564/data/king2.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1564/data/king2.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1564/data/king2.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1564/data/king20.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1564/data/king20.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1564/data/king20.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1564/data/king20.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1564/data/king21.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1564/data/king21.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1564/data/king21.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1564/data/king21.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1564/data/king22.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1564/data/king22.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1564/data/king22.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1564/data/king22.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1564/data/king23.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1564/data/king23.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1564/data/king23.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1564/data/king23.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1564/data/king24.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1564/data/king24.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1564/data/king24.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1564/data/king24.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1564/data/king25.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1564/data/king25.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1564/data/king25.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1564/data/king25.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1564/data/king26.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1564/data/king26.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1564/data/king26.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1564/data/king26.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1564/data/king27.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1564/data/king27.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1564/data/king27.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1564/data/king27.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1564/data/king28.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1564/data/king28.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1564/data/king28.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1564/data/king28.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1564/data/king29.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1564/data/king29.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1564/data/king29.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1564/data/king29.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1564/data/king3.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1564/data/king3.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1564/data/king3.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1564/data/king3.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1564/data/king30.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1564/data/king30.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1564/data/king30.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1564/data/king30.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1564/data/king31.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1564/data/king31.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1564/data/king31.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1564/data/king31.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1564/data/king32.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1564/data/king32.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1564/data/king32.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1564/data/king32.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1564/data/king33.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1564/data/king33.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1564/data/king33.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1564/data/king33.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1564/data/king34.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1564/data/king34.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1564/data/king34.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1564/data/king34.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1564/data/king35.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1564/data/king35.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1564/data/king35.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1564/data/king35.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1564/data/king36.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1564/data/king36.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1564/data/king36.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1564/data/king36.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1564/data/king4.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1564/data/king4.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1564/data/king4.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1564/data/king4.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1564/data/king5.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1564/data/king5.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1564/data/king5.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1564/data/king5.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1564/data/king6.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1564/data/king6.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1564/data/king6.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1564/data/king6.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1564/data/king7.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1564/data/king7.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1564/data/king7.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1564/data/king7.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1564/data/king8.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1564/data/king8.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1564/data/king8.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1564/data/king8.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1564/data/king9.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1564/data/king9.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1564/data/king9.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1564/data/king9.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1564/data/problem.conf
(Stored with Git LFS)
Normal file
BIN
S2OJ/1564/data/problem.conf
(Stored with Git LFS)
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user