Submission #1054984

# Submission time Handle Problem Language Result Execution time Memory
1054984 2024-08-12T13:42:12 Z Rafi22 Make them Meet (EGOI24_makethemmeet) C++14
2.92166 / 100
78 ms 22352 KB
#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 time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 360 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Partially correct 74 ms 21520 KB Partially correct
5 Partially correct 78 ms 22352 KB Partially correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Runtime error 0 ms 604 KB Execution killed with signal 6
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Incorrect 0 ms 348 KB If people start at 0 and 1, then they can avoid each other
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 360 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Partially correct 74 ms 21520 KB Partially correct
5 Partially correct 78 ms 22352 KB Partially correct
6 Correct 0 ms 348 KB Output is correct
7 Incorrect 0 ms 348 KB If people start at 0 and 1, then they can avoid each other
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 360 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Partially correct 74 ms 21520 KB Partially correct
5 Partially correct 78 ms 22352 KB Partially correct
6 Correct 0 ms 344 KB Output is correct
7 Runtime error 0 ms 604 KB Execution killed with signal 6
8 Halted 0 ms 0 KB -