# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
522660 | Andy__Andy__ | Ronald (COCI17_ronald) | C++17 | 104 ms | 8672 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#define ll long long
#define int ll
using namespace std;
ifstream f ("test.in");
ofstream g ("test.out");
int teste=1;
int n,m;
vector < int > G[1005];
int viz[1005];
void dfs(int nod,int tata)
{ viz[nod] =1;
for(int vecin:G[nod])
{
if(vecin == tata or viz[vecin]) continue;
dfs(vecin,nod);
}
}
void solve()
{
cin>>n>>m;
for(int i=1;i<=m;++i)
{
int a,b;
cin>>a>>b;
G[a].push_back(b);
G[b].push_back(a);
}
int cnt = 0;
for(int i=1;i<=n;++i)
{
if(!viz[i])
{
dfs(i,-1);
++cnt;
}
}
int all=1;
for(int i=1;i<=n;++i)
{
if(G[i].size() != G[1].size()) all = 0;
}
if(cnt<=2 and all)
{
cout<< "DA";
}
else
{
cout<< "NE";
}
}
main()
{
while(teste--)
{
solve();
}
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |