Submission #865686

# Submission time Handle Problem Language Result Execution time Memory
865686 2023-10-24T14:04:56 Z Rifal Newspapers (CEOI21_newspapers) C++14
0 / 100
0 ms 604 KB
#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";
    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 600 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 604 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 600 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -