제출 #1125113

#제출 시각아이디문제언어결과실행 시간메모리
1125113PanndaNewspapers (CEOI21_newspapers)C++20
0 / 100
1 ms328 KiB
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int n, m; cin >> n >> m; vector<vector<int>> adj(n); for (int i = 0; i < m; i++) { int u, v; cin >> u >> v; u--; v--; adj[u].push_back(v); adj[v].push_back(u); } if (m != n - 1) { cout << "NO\n"; return 0; } if (n >= 5) { cout << "NO\n"; } else if (n == 4) { cout << "YES\n"; cout << "5\n"; cout << "2 2 3 3 2\n"; } else if (n == 2 || n == 3) { cout << "YES\n"; cout << "2\n2 2\n"; } else { cout << "YES\n1\n1\n"; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...