Submission #464048

#TimeUsernameProblemLanguageResultExecution timeMemory
464048prvocisloUntitled (POI11_imp)C++17
100 / 100
798 ms33588 KiB
#include <iostream> #include <vector> #include <set> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); int n, m; cin >> n >> m; vector<vector<bool> > g(n, vector<bool>(n, false)); for (int i = 0, a, b; i < m; i++) { cin >> a >> b; a--, b--; g[a][b] = g[b][a] = true; } vector<bool> alive(n, true); for (int i = 0; i < n; i++) for (int j = 0; j < i; j++) { if (alive[i] && alive[j] && !g[i][j]) { alive[i] = alive[j] = false; } } vector<int> k; for (int i = 0; i < n; i++) if (alive[i]) k.push_back(i); for (int i = 0; i < n / 3; i++) cout << k[i] + 1 << " \n"[i == n / 3 - 1]; 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...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...