#include <bits/stdc++.h>
//#pragma GCC optimize("O3")
#define fr(i, a, b) for (int i = (a); i <= (b); ++i)
#define rf(i, a, b) for (int i = (a); i >= (b); --i)
#define fe(x, y) for (auto& x : y)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define all(x) (x).begin(), (x).end()
#define pw(x) (1LL << (x))
#define sz(x) (int)(x).size()
using namespace std;
//mt19937_64 rng(chrono::system_clock::now().time_since_epoch().count());
mt19937_64 rng(228);
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
template <typename T>
using oset = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
#define fbo find_by_order
#define ook order_of_key
template <typename T>
bool umn(T& a, T b) {
return a > b ? a = b, 1 : 0;
}
template <typename T>
bool umx(T& a, T b) {
return a < b ? a = b, 1 : 0;
}
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
template <typename T>
using ve = vector<T>;
const int N = 1005;
int n, m;
ve<int> g[N];
int vis[N];
void dfs(int v, int p) {
vis[v] = 1;
fe (to, g[v]) {
if (to == p) continue;
if (!vis[to]) {
dfs(to, v);
} else {
if (vis[to] == 1) {
cout << "NO\n";
// cout << "0\n";
exit(0);
}
}
}
vis[v] = 2;
}
int main() {
#ifdef LOCAL
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#else
ios::sync_with_stdio(0);
cin.tie(0);
#endif
// cout << "YES\n";
// return 0;
cin >> n >> m;
fr (i, 1, m) {
int a, b;
cin >> a >> b;
g[a].pb(b);
g[b].pb(a);
}
fr (i, 1, n) {
if (!vis[i]) {
dfs(i, -1);
}
}
cout << "YES\n";
cout << "1\n";
cout << "1\n";
// ve<int> ans;
//
// fr (i, 1, n) ans.pb(i);
//
// cout << sz(ans) << "\n";
// fe (x, ans) {
// cout << x << " ";
// }
// cout << "\n";
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
340 KB |
Output is correct |
2 |
Partially correct |
0 ms |
340 KB |
Failed to provide a successful strategy. |
3 |
Partially correct |
0 ms |
340 KB |
Failed to provide a successful strategy. |
4 |
Partially correct |
0 ms |
340 KB |
Failed to provide a successful strategy. |
5 |
Partially correct |
0 ms |
340 KB |
Failed to provide a successful strategy. |
6 |
Partially correct |
0 ms |
340 KB |
Failed to provide a successful strategy. |
7 |
Correct |
0 ms |
340 KB |
Output is correct |
8 |
Partially correct |
0 ms |
340 KB |
Failed to provide a successful strategy. |
9 |
Incorrect |
0 ms |
340 KB |
Output isn't correct |
10 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Partially correct |
0 ms |
340 KB |
Failed to provide a successful strategy. |
3 |
Partially correct |
0 ms |
340 KB |
Failed to provide a successful strategy. |
4 |
Partially correct |
0 ms |
340 KB |
Failed to provide a successful strategy. |
5 |
Partially correct |
0 ms |
340 KB |
Failed to provide a successful strategy. |
6 |
Partially correct |
0 ms |
340 KB |
Failed to provide a successful strategy. |
7 |
Partially correct |
0 ms |
340 KB |
Failed to provide a successful strategy. |
8 |
Partially correct |
0 ms |
340 KB |
Failed to provide a successful strategy. |
9 |
Partially correct |
0 ms |
340 KB |
Failed to provide a successful strategy. |
10 |
Partially correct |
0 ms |
340 KB |
Failed to provide a successful strategy. |
11 |
Partially correct |
1 ms |
340 KB |
Failed to provide a successful strategy. |
12 |
Partially correct |
0 ms |
340 KB |
Failed to provide a successful strategy. |
13 |
Partially correct |
1 ms |
340 KB |
Failed to provide a successful strategy. |
14 |
Partially correct |
0 ms |
340 KB |
Failed to provide a successful strategy. |
15 |
Partially correct |
1 ms |
340 KB |
Failed to provide a successful strategy. |
16 |
Partially correct |
1 ms |
340 KB |
Failed to provide a successful strategy. |
17 |
Partially correct |
1 ms |
340 KB |
Failed to provide a successful strategy. |
18 |
Partially correct |
1 ms |
340 KB |
Failed to provide a successful strategy. |
19 |
Partially correct |
1 ms |
340 KB |
Failed to provide a successful strategy. |
20 |
Partially correct |
1 ms |
340 KB |
Failed to provide a successful strategy. |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
340 KB |
Output is correct |
2 |
Partially correct |
0 ms |
340 KB |
Failed to provide a successful strategy. |
3 |
Partially correct |
0 ms |
340 KB |
Failed to provide a successful strategy. |
4 |
Partially correct |
0 ms |
340 KB |
Failed to provide a successful strategy. |
5 |
Partially correct |
0 ms |
340 KB |
Failed to provide a successful strategy. |
6 |
Partially correct |
0 ms |
340 KB |
Failed to provide a successful strategy. |
7 |
Correct |
0 ms |
340 KB |
Output is correct |
8 |
Partially correct |
0 ms |
340 KB |
Failed to provide a successful strategy. |
9 |
Incorrect |
0 ms |
340 KB |
Output isn't correct |
10 |
Halted |
0 ms |
0 KB |
- |