Submission #1054984

#TimeUsernameProblemLanguageResultExecution timeMemory
1054984Rafi22Make them Meet (EGOI24_makethemmeet)C++14
2.92 / 100
78 ms22352 KiB
#include <bits/stdc++.h> using namespace std; #ifdef DEBUG auto&operator<<(auto&o,pair<auto,auto>p){return o<<"("<<p.first<<", "<<p.second<<")";} auto operator<<(auto&o,auto x)->decltype(x.end(),o){o<<"{";int i=0;for(auto e:x)o<<","+!i++<<e;return o<<"}";} #define debug(X...)cerr<<"["#X"]: ",[](auto...$){((cerr<<$<<"; "),...)<<endl;}(X) #else #define debug(...){} #endif #define int long long #define ll long long #define ld long double #define endl '\n' #define st first #define nd second #define pb push_back #define sz(x) (int)(x).size() #define all(x) (x).begin(), (x).end() #define FOR(i,l,r) for(int i=(l);i<=(r);i++) #define ROF(i,r,l) for(int i=(r);i>=(l);i--) int inf=1000000000000000007; int mod=1000000007; int mod1=998244353; const int N=107; int n; vector<int>G[N]; vector<vector<int>>ans; void dfs(int v,int o) { for(auto u:G[v]) { if(u==o) continue; vector<int>V(n); FOR(i,0,n-1) V[i]=i; V[u]=v; ans.pb(V); dfs(u,v); } if(o!=-1) { vector<int>V(n); FOR(i,0,n-1) V[i]=i; V[o]=v; ans.pb(V); } } signed main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin>>n; FOR(i,1,n-1) { int a,b; cin>>a>>b; G[a].pb(b); G[b].pb(a); } FOR(i,0,n-1) dfs(i,-1); cout<<sz(ans)<<endl; for(auto V:ans) { for(auto x:V) cout<<x<<" "; cout<<endl; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...