#include <bits/stdc++.h>
#include <fstream>
//#define endl '\n'
#define mod 1000000007
#define INF 9000000000000000
using namespace std;
const int Max = 1e4;
vector<int> v[Max];
bool ok[Max];
void dfs(int s, int p) {
ok[s] = 1;
for(auto i : v[s]) {
if(i != p) {
if(ok[i] == 1) {
cout << "NO";
exit(0);
}
dfs(i,s);
}
}
}
int main()
{
ios_base::sync_with_stdio(0);cout.tie(0);cin.tie(0);
int n, m; cin >> n >> m;
for(int i = 0; i < m; i++) {
int a, b; cin >> a >> b;
v[a].push_back(b);
v[b].push_back(a);
}
dfs(1,0);
cout << "YES" << endl << '0';
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
604 KB |
Integer parameter [name=k] equals to 0, violates the range [1, 5] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
612 KB |
Integer parameter [name=k] equals to 0, violates the range [1, 5] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
604 KB |
Integer parameter [name=k] equals to 0, violates the range [1, 5] |
2 |
Halted |
0 ms |
0 KB |
- |