Submission #960866

#TimeUsernameProblemLanguageResultExecution timeMemory
960866PringPovjerenstvo (COI22_povjerenstvo)C++17
100 / 100
266 ms37332 KiB
#include <bits/stdc++.h> using namespace std; #ifdef MIKU string dbmc = "\033[1;38;2;57;197;187m", dbrs = "\033[0m"; #define debug(x...) cout << dbmc << "[" << #x << "]: ", dout(x) void dout() { cout << dbrs << endl; } template <typename T, typename ...U> void dout(T t, U ...u) { cout << t << (sizeof...(u) ? ", " : ""); dout(u...); } #else #define debug(...) 39 #endif #define fs first #define sc second #define mp make_pair #define FOR(i, j, k) for (int i = j, Z = k; i < Z; i++) using ll = long long; typedef pair<int, int> pii; const int MXN = 500005; int n, m; vector<int> edge[MXN]; bitset<MXN> ban; vector<int> ans; void miku() { int x, y; cin >> n >> m; while (m--) { cin >> x >> y; edge[x].push_back(y); edge[y].push_back(x); } FOR(id, 1, n + 1) { if (ban[id]) continue; ans.push_back(id); for (auto &i : edge[id]) ban[i] = true; } cout << ans.size() << '\n'; for (auto &i : ans) cout << i << ' '; cout << '\n'; } int32_t main() { cin.tie(0) -> sync_with_stdio(false); cin.exceptions(cin.failbit); miku(); return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...