답안 #1054981

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1054981 2024-08-12T13:40:33 Z Rafi22 Make them Meet (EGOI24_makethemmeet) C++14
2.92166 / 100
75 ms 20648 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,1);
		V[v]=2;
		V[u]=2;
		ans.pb(V);
		dfs(u,v);
	}
	if(o!=-1)
	{
		vector<int>V(n,1);
		V[v]=2;
		V[o]=2;
		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;
}








# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Partially correct 72 ms 19740 KB Partially correct
5 Partially correct 75 ms 20648 KB Partially correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Runtime error 0 ms 604 KB Execution killed with signal 6
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 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 -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Partially correct 72 ms 19740 KB Partially correct
5 Partially correct 75 ms 20648 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 -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Partially correct 72 ms 19740 KB Partially correct
5 Partially correct 75 ms 20648 KB Partially correct
6 Correct 0 ms 348 KB Output is correct
7 Runtime error 0 ms 604 KB Execution killed with signal 6
8 Halted 0 ms 0 KB -