Submission #1055003

# Submission time Handle Problem Language Result Execution time Memory
1055003 2024-08-12T13:50:11 Z Rafi22 Make them Meet (EGOI24_makethemmeet) C++14
16.6535 / 100
554 ms 1048576 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);
    int m;
    cin>>n>>m;
    FOR(i,1,m)
    {
		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 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Partially correct 76 ms 21496 KB Partially correct
5 Partially correct 79 ms 22424 KB Partially correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Runtime error 554 ms 1048576 KB Execution killed with signal 9
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 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Partially correct 16 ms 3004 KB Partially correct
5 Partially correct 77 ms 21488 KB Partially correct
6 Partially correct 81 ms 22324 KB Partially correct
7 Partially correct 22 ms 6224 KB Partially correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Partially correct 76 ms 21496 KB Partially correct
5 Partially correct 79 ms 22424 KB Partially correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Partially correct 16 ms 3004 KB Partially correct
10 Partially correct 77 ms 21488 KB Partially correct
11 Partially correct 81 ms 22324 KB Partially correct
12 Partially correct 22 ms 6224 KB Partially correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Partially correct 103 ms 21648 KB Partially correct
17 Partially correct 77 ms 22280 KB Partially correct
18 Correct 1 ms 344 KB Output is correct
19 Correct 1 ms 348 KB Output is correct
20 Partially correct 9 ms 2840 KB Partially correct
21 Partially correct 109 ms 21668 KB Partially correct
22 Partially correct 79 ms 22284 KB Partially correct
23 Partially correct 21 ms 6236 KB Partially correct
24 Correct 0 ms 344 KB Output is correct
25 Correct 0 ms 348 KB Output is correct
26 Correct 0 ms 348 KB Output is correct
27 Partially correct 99 ms 22424 KB Partially correct
28 Partially correct 77 ms 22364 KB Partially correct
29 Partially correct 125 ms 22284 KB Partially correct
30 Partially correct 95 ms 22344 KB Partially correct
31 Partially correct 79 ms 22376 KB Partially correct
32 Partially correct 100 ms 22284 KB Partially correct
33 Partially correct 91 ms 22300 KB Partially correct
34 Partially correct 78 ms 22392 KB Partially correct
35 Partially correct 82 ms 22280 KB Partially correct
36 Partially correct 78 ms 22280 KB Partially correct
37 Partially correct 77 ms 22432 KB Partially correct
38 Partially correct 78 ms 22280 KB Partially correct
39 Partially correct 78 ms 22288 KB Partially correct
40 Partially correct 78 ms 22432 KB Partially correct
41 Partially correct 85 ms 22276 KB Partially correct
42 Partially correct 81 ms 22384 KB Partially correct
43 Partially correct 92 ms 22276 KB Partially correct
44 Partially correct 78 ms 22536 KB Partially correct
45 Partially correct 78 ms 22332 KB Partially correct
46 Correct 0 ms 344 KB Output is correct
47 Correct 0 ms 460 KB Output is correct
48 Correct 0 ms 348 KB Output is correct
49 Correct 0 ms 348 KB Output is correct
50 Correct 0 ms 456 KB Output is correct
51 Correct 0 ms 348 KB Output is correct
52 Correct 0 ms 348 KB Output is correct
53 Correct 0 ms 348 KB Output is correct
54 Correct 0 ms 348 KB Output is correct
55 Correct 1 ms 344 KB Output is correct
56 Correct 0 ms 348 KB Output is correct
57 Correct 0 ms 348 KB Output is correct
58 Correct 0 ms 348 KB Output is correct
59 Correct 0 ms 460 KB Output is correct
60 Correct 0 ms 348 KB Output is correct
61 Correct 0 ms 348 KB Output is correct
62 Correct 1 ms 348 KB Output is correct
63 Correct 0 ms 348 KB Output is correct
64 Correct 0 ms 348 KB Output is correct
65 Correct 0 ms 600 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Partially correct 76 ms 21496 KB Partially correct
5 Partially correct 79 ms 22424 KB Partially correct
6 Correct 1 ms 344 KB Output is correct
7 Runtime error 554 ms 1048576 KB Execution killed with signal 9
8 Halted 0 ms 0 KB -