#include <algorithm>
#include <iostream>
#include <numeric>
#include <cassert>
#include <vector>
#include <queue>
typedef long long llong;
const int MAXN = 300000 + 10;
const int INF = 1e9;
int n, m;
std::vector <int> order;
std::vector <int> g[MAXN];
void dfs(int node, int par)
{
order.push_back(node);
for (const int &u : g[node])
{
if (u == par)
{
continue;
}
dfs(u, node);
order.push_back(node);
}
}
void solve()
{
dfs(1, 0);
std::cout << "YES\n";
std::cout << order.size() << '\n';
for (const int &u : order)
{
std::cout << u << ' ';
}
std::cout << '\n';
}
void input()
{
std::cin >> n >> m;
if (m >= n)
{
std::cout << "NO\n";
exit(-1);
}
for (int i = 1 ; i <= m ; ++i)
{
int u, v;
std::cin >> u >> v;
g[u].push_back(v);
g[v].push_back(u);
}
}
void fastIOI()
{
std::ios_base :: sync_with_stdio(0);
std::cout.tie(nullptr);
std::cin.tie(nullptr);
}
int main()
{
fastIOI();
input();
solve();
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
7256 KB |
Output is correct |
2 |
Partially correct |
2 ms |
7260 KB |
Failed to provide a successful strategy. |
3 |
Partially correct |
2 ms |
7260 KB |
Failed to provide a successful strategy. |
4 |
Partially correct |
2 ms |
7260 KB |
Failed to provide a successful strategy. |
5 |
Partially correct |
2 ms |
7260 KB |
Failed to provide a successful strategy. |
6 |
Partially correct |
3 ms |
7260 KB |
Failed to provide a successful strategy. |
7 |
Runtime error |
3 ms |
7260 KB |
Execution failed because the return code was nonzero |
8 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
7512 KB |
Output is correct |
2 |
Partially correct |
2 ms |
7260 KB |
Failed to provide a successful strategy. |
3 |
Partially correct |
2 ms |
7260 KB |
Failed to provide a successful strategy. |
4 |
Partially correct |
3 ms |
7260 KB |
Failed to provide a successful strategy. |
5 |
Partially correct |
2 ms |
7260 KB |
Failed to provide a successful strategy. |
6 |
Partially correct |
2 ms |
7256 KB |
Failed to provide a successful strategy. |
7 |
Partially correct |
2 ms |
7256 KB |
Failed to provide a successful strategy. |
8 |
Partially correct |
2 ms |
7272 KB |
Failed to provide a successful strategy. |
9 |
Partially correct |
2 ms |
7260 KB |
Failed to provide a successful strategy. |
10 |
Partially correct |
3 ms |
7516 KB |
Failed to provide a successful strategy. |
11 |
Partially correct |
4 ms |
7516 KB |
Failed to provide a successful strategy. |
12 |
Partially correct |
3 ms |
7516 KB |
Failed to provide a successful strategy. |
13 |
Partially correct |
2 ms |
7516 KB |
Failed to provide a successful strategy. |
14 |
Partially correct |
4 ms |
7512 KB |
Failed to provide a successful strategy. |
15 |
Partially correct |
2 ms |
7516 KB |
Failed to provide a successful strategy. |
16 |
Partially correct |
2 ms |
7516 KB |
Failed to provide a successful strategy. |
17 |
Partially correct |
3 ms |
7516 KB |
Failed to provide a successful strategy. |
18 |
Partially correct |
2 ms |
7516 KB |
Failed to provide a successful strategy. |
19 |
Partially correct |
3 ms |
7516 KB |
Failed to provide a successful strategy. |
20 |
Partially correct |
2 ms |
7516 KB |
Failed to provide a successful strategy. |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
7256 KB |
Output is correct |
2 |
Partially correct |
2 ms |
7260 KB |
Failed to provide a successful strategy. |
3 |
Partially correct |
2 ms |
7260 KB |
Failed to provide a successful strategy. |
4 |
Partially correct |
2 ms |
7260 KB |
Failed to provide a successful strategy. |
5 |
Partially correct |
2 ms |
7260 KB |
Failed to provide a successful strategy. |
6 |
Partially correct |
3 ms |
7260 KB |
Failed to provide a successful strategy. |
7 |
Runtime error |
3 ms |
7260 KB |
Execution failed because the return code was nonzero |
8 |
Halted |
0 ms |
0 KB |
- |