1233 | 2022-03-27 14:28:09 | Valaki2 | Turista járatok | cpp14 | Wrong answer 0/100 | 162ms | 44660 KiB |
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
#define fi first
#define se second
const int maxn = 40000;
int n, m, k;
vector<pair<int, int> > g[maxn + 1];
bool vis[maxn + 1];
vector<int> ans;
void dfs(int cur, int ok) {
if(ok) {
ans.pb(cur);
}
vis[cur] = true;
for(pair<int, int> nei : g[cur]) {
if(!vis[nei.fi]) {
dfs(nei.fi, max(ok, nei.se));
}
}
}
void solve() {
cin >> n >> m >> k;
for(int i = 1; i <= m; i++) {
int a, b;
cin >> a >> b;
if(i <= k) {
g[a].pb(mp(b, 1));
g[b].pb(mp(a, 1));
} else {
g[a].pb(mp(b, 0));
g[b].pb(mp(a, 0));
}
}
dfs(1, 0);
sort(ans.begin(), ans.end());
cout << (int) ans.size() << "\n";
for(int x : ans) {
cout << x << " ";
}
cout << "\n";
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
solve();
return 0;
}
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/0 | ||||||
1 | Wrong answer | 3ms | 3848 KiB | ||||
2 | Accepted | 8ms | 5140 KiB | ||||
subtask2 | 0/10 | ||||||
3 | Accepted | 2ms | 4056 KiB | ||||
4 | Accepted | 2ms | 4060 KiB | ||||
5 | Wrong answer | 2ms | 4068 KiB | ||||
6 | Wrong answer | 2ms | 4076 KiB | ||||
7 | Wrong answer | 2ms | 4084 KiB | ||||
subtask3 | 0/10 | ||||||
8 | Wrong answer | 2ms | 4084 KiB | ||||
9 | Accepted | 2ms | 4084 KiB | ||||
10 | Accepted | 2ms | 4092 KiB | ||||
11 | Accepted | 3ms | 4128 KiB | ||||
12 | Accepted | 4ms | 4560 KiB | ||||
subtask4 | 0/10 | ||||||
13 | Accepted | 6ms | 5056 KiB | ||||
14 | Accepted | 2ms | 4256 KiB | ||||
15 | Accepted | 2ms | 4304 KiB | ||||
16 | Accepted | 3ms | 4492 KiB | ||||
17 | Wrong answer | 162ms | 33556 KiB | ||||
18 | Wrong answer | 48ms | 14280 KiB | ||||
19 | Wrong answer | 61ms | 17500 KiB | ||||
20 | Wrong answer | 41ms | 16528 KiB | ||||
subtask5 | 0/10 | ||||||
21 | Accepted | 8ms | 12576 KiB | ||||
22 | Wrong answer | 2ms | 11636 KiB | ||||
23 | Wrong answer | 2ms | 11644 KiB | ||||
24 | Wrong answer | 2ms | 11660 KiB | ||||
25 | Wrong answer | 89ms | 29968 KiB | ||||
26 | Wrong answer | 7ms | 15592 KiB | ||||
27 | Wrong answer | 7ms | 15740 KiB | ||||
subtask6 | 0/60 | ||||||
28 | Wrong answer | 2ms | 14808 KiB | ||||
29 | Accepted | 2ms | 14964 KiB | ||||
30 | Accepted | 4ms | 15020 KiB | ||||
31 | Accepted | 4ms | 15224 KiB | ||||
32 | Wrong answer | 4ms | 15316 KiB | ||||
33 | Accepted | 4ms | 15552 KiB | ||||
34 | Accepted | 8ms | 16124 KiB | ||||
35 | Accepted | 9ms | 16384 KiB | ||||
36 | Accepted | 8ms | 16420 KiB | ||||
37 | Wrong answer | 160ms | 44660 KiB | ||||
38 | Wrong answer | 37ms | 25428 KiB | ||||
39 | Wrong answer | 39ms | 26348 KiB | ||||
40 | Wrong answer | 37ms | 27260 KiB | ||||
41 | Wrong answer | 41ms | 28140 KiB | ||||
42 | Wrong answer | 37ms | 28896 KiB | ||||
43 | Wrong answer | 37ms | 29948 KiB | ||||
44 | Wrong answer | 35ms | 30680 KiB | ||||
45 | Wrong answer | 56ms | 33956 KiB | ||||
46 | Wrong answer | 35ms | 33064 KiB | ||||
47 | Wrong answer | 39ms | 33828 KiB | ||||
48 | Wrong answer | 37ms | 34696 KiB | ||||
49 | Wrong answer | 39ms | 35768 KiB | ||||
50 | Wrong answer | 43ms | 36672 KiB |