This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define x first
#define y second
ll N, M, used[500005];
vector<ll> G[500005];
int main(){
cin.tie(0) -> sync_with_stdio(0);
cin >> N >> M;
for(ll i = 1; i <= M; i++){
ll u, v; cin >> u >> v;
G[u].push_back(v); G[v].push_back(u);
}
vector<ll> R;
for(ll i = 1; i <= N; i++){
if(used[i]) continue;
for(auto v : G[i]){
used[v] = 1;
}
R.push_back(i);
}
cout << R.size() << '\n';
for(auto e : R){
cout << e << ' ';
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |