#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(0);
}
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;
}
# |
Verdict |
Execution time |
Memory |
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 |
7256 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 |
Correct |
2 ms |
7260 KB |
Output is correct |
8 |
Partially correct |
2 ms |
7256 KB |
Failed to provide a successful strategy. |
9 |
Incorrect |
2 ms |
7256 KB |
Output isn't correct |
10 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
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 |
7272 KB |
Failed to provide a successful strategy. |
4 |
Partially correct |
2 ms |
7256 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 |
7260 KB |
Failed to provide a successful strategy. |
7 |
Partially correct |
2 ms |
7260 KB |
Failed to provide a successful strategy. |
8 |
Partially correct |
2 ms |
7504 KB |
Failed to provide a successful strategy. |
9 |
Partially correct |
3 ms |
7260 KB |
Failed to provide a successful strategy. |
10 |
Partially correct |
2 ms |
7260 KB |
Failed to provide a successful strategy. |
11 |
Partially correct |
2 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 |
3 ms |
7516 KB |
Failed to provide a successful strategy. |
15 |
Partially correct |
2 ms |
7512 KB |
Failed to provide a successful strategy. |
16 |
Partially correct |
2 ms |
7512 KB |
Failed to provide a successful strategy. |
17 |
Partially correct |
3 ms |
7772 KB |
Failed to provide a successful strategy. |
18 |
Partially correct |
2 ms |
7516 KB |
Failed to provide a successful strategy. |
19 |
Partially correct |
2 ms |
7512 KB |
Failed to provide a successful strategy. |
20 |
Partially correct |
2 ms |
7516 KB |
Failed to provide a successful strategy. |
# |
Verdict |
Execution time |
Memory |
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 |
7256 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 |
Correct |
2 ms |
7260 KB |
Output is correct |
8 |
Partially correct |
2 ms |
7256 KB |
Failed to provide a successful strategy. |
9 |
Incorrect |
2 ms |
7256 KB |
Output isn't correct |
10 |
Halted |
0 ms |
0 KB |
- |