// #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, color[1001];
vi graph[1001];
void bip(int u, int c) {
if (color[u] == -1)
color[u] = c;
else {
if (color[u] != c) {
cout << "NO" << endl;
exit(0);
}
return;
}
trav(v, graph[u]) bip(v, c ^ 1);
}
int main() {
cin.tie(0)->sync_with_stdio(0);
cin.exceptions(cin.failbit);
memset(color, -1, sizeof(color));
cin >> n >> m;
rep(i, 0, m) {
int u, v;
cin >> u >> v;
graph[--u].pb(--v);
graph[v].pb(u);
}
bip(0, 0);
rep(i,0,n)assert(color[i]!=-1);
cout << "YES" << endl;
cout << "1\n1\n";
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
332 KB |
Output is correct |
2 |
Partially correct |
1 ms |
332 KB |
Failed to provide a successful strategy. |
3 |
Partially correct |
1 ms |
332 KB |
Failed to provide a successful strategy. |
4 |
Partially correct |
0 ms |
204 KB |
Failed to provide a successful strategy. |
5 |
Partially correct |
0 ms |
332 KB |
Failed to provide a successful strategy. |
6 |
Partially correct |
0 ms |
204 KB |
Failed to provide a successful strategy. |
7 |
Correct |
0 ms |
332 KB |
Output is correct |
8 |
Partially correct |
0 ms |
204 KB |
Failed to provide a successful strategy. |
9 |
Incorrect |
0 ms |
332 KB |
Output isn't correct |
10 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
332 KB |
Output is correct |
2 |
Partially correct |
0 ms |
332 KB |
Failed to provide a successful strategy. |
3 |
Partially correct |
0 ms |
332 KB |
Failed to provide a successful strategy. |
4 |
Partially correct |
0 ms |
332 KB |
Failed to provide a successful strategy. |
5 |
Partially correct |
1 ms |
332 KB |
Failed to provide a successful strategy. |
6 |
Partially correct |
0 ms |
332 KB |
Failed to provide a successful strategy. |
7 |
Partially correct |
0 ms |
332 KB |
Failed to provide a successful strategy. |
8 |
Partially correct |
0 ms |
332 KB |
Failed to provide a successful strategy. |
9 |
Partially correct |
0 ms |
332 KB |
Failed to provide a successful strategy. |
10 |
Partially correct |
0 ms |
332 KB |
Failed to provide a successful strategy. |
11 |
Partially correct |
1 ms |
332 KB |
Failed to provide a successful strategy. |
12 |
Partially correct |
1 ms |
332 KB |
Failed to provide a successful strategy. |
13 |
Partially correct |
0 ms |
332 KB |
Failed to provide a successful strategy. |
14 |
Partially correct |
0 ms |
332 KB |
Failed to provide a successful strategy. |
15 |
Partially correct |
1 ms |
332 KB |
Failed to provide a successful strategy. |
16 |
Partially correct |
1 ms |
332 KB |
Failed to provide a successful strategy. |
17 |
Partially correct |
1 ms |
332 KB |
Failed to provide a successful strategy. |
18 |
Partially correct |
1 ms |
332 KB |
Failed to provide a successful strategy. |
19 |
Partially correct |
1 ms |
332 KB |
Failed to provide a successful strategy. |
20 |
Partially correct |
0 ms |
332 KB |
Failed to provide a successful strategy. |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
332 KB |
Output is correct |
2 |
Partially correct |
1 ms |
332 KB |
Failed to provide a successful strategy. |
3 |
Partially correct |
1 ms |
332 KB |
Failed to provide a successful strategy. |
4 |
Partially correct |
0 ms |
204 KB |
Failed to provide a successful strategy. |
5 |
Partially correct |
0 ms |
332 KB |
Failed to provide a successful strategy. |
6 |
Partially correct |
0 ms |
204 KB |
Failed to provide a successful strategy. |
7 |
Correct |
0 ms |
332 KB |
Output is correct |
8 |
Partially correct |
0 ms |
204 KB |
Failed to provide a successful strategy. |
9 |
Incorrect |
0 ms |
332 KB |
Output isn't correct |
10 |
Halted |
0 ms |
0 KB |
- |