Submission #495583

#TimeUsernameProblemLanguageResultExecution timeMemory
495583VictorNewspapers (CEOI21_newspapers)C++17
4 / 100
1 ms332 KiB
// #pragma GCC target ("avx,avx2,fma") // #pragma GCC optimize ("Ofast,inline") // O1 - O2 - O3 - Os - Ofast // #pragma GCC optimize ("unroll-loops") #include <bits/stdc++.h> using namespace std; #define rep(i, a, b) for (int i = (a); i < (b); ++i) #define per(i, a, b) for (int i = (b - 1); i >= (a); --i) #define trav(a, x) for (auto &a : x) #define all(x) x.begin(), x.end() #define sz(x) x.size() #define pb push_back #define debug(x) cout << #x << " = " << x << endl #define umap unordered_map #define uset unordered_set typedef pair<int, int> ii; typedef pair<int, ii> iii; typedef vector<int> vi; typedef vector<ii> vii; typedef vector<vi> vvi; typedef long long ll; typedef pair<ll, ll> pll; typedef vector<ll> vll; typedef vector<pll> vpll; const int INF = 1'000'000'007; int n, m; bitset<1001> vis; vi graph[1001]; void cycle(int u, int p) { if (vis[u]) { cout << "NO" << endl; exit(0); } vis[u] = 1; trav(v, graph[u]) if (v != p) cycle(v, u); } int main() { cin.tie(0)->sync_with_stdio(0); cin.exceptions(cin.failbit); cin >> n >> m; rep(i, 0, m) { int u, v; cin >> u >> v; graph[--u].pb(--v); graph[v].pb(u); } cycle(0, 0); cout << "YES" << endl; cout << "1\n1\n"; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...