This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
#define sz(x) (int)x.size()
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define cmin(a, b) a=min(a, b)
#define cmax(a, b) a=max(a, b)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define int long long
void solve();
signed main() {
ios::sync_with_stdio(0); cin.tie(0);
solve();
return 0;
}
vector<vector<int>> vec;
void print() {
cout << sz(vec) << endl;
for (auto &a: vec) {
for (auto &u: a) cout << u << ' ';
cout << endl;
}
cout << endl;
}
void add(vector<int> &a) { vec.pb(a); }
int n, m;
vector<int> a;
vector<vector<int>> adj;
vector<bool> visited;
void dfs(int x) {
visited[x]=1;
for (auto u: adj[x]) if (!visited[u]) {
auto temp=a; temp[x]=0, temp[u]=0;
add(temp);
dfs(u);
add(temp);
}
}
void solve() {
cin >> n >> m; a.clear(), a.resize(n, 0); iota(all(a), 1);
adj.clear(), adj.resize(n);
for (int i=0; i<m; i++) {
int u, v; cin >> u >> v;
adj[u].pb(v), adj[v].pb(u);
}
for (int i=0; i<n; i++) {
visited.clear(), visited.resize(n, 0);
dfs(i);
}
print();
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |