# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
660716 |
2022-11-22T21:20:25 Z |
Ahmed57 |
Ronald (COCI17_ronald) |
C++14 |
|
162 ms |
21976 KB |
#include <bits/stdc++.h>
using namespace std;
vector<int> adj[100001];
int vis[100001];
long long sum = 0 , cn = 0;
void dfs(int i){
cn++;
vis[i] = 1;
sum+=adj[i].size();
for(auto j:adj[i]){
if(vis[j])continue;
dfs(j);
}
}
int main(){
int n,m;cin>>n>>m;
map<pair<int,int>,int> mp;
int ans = 0;
for(int i=0;i<m;i++){
int x,y;
cin>>x>>y;
if(x==y)continue;
if(x>y)swap(x,y);
if(mp[{x,y}]==1)continue;
mp[{x,y}] = 1;
ans++;
adj[x].push_back(y);
}
if(ans==n*(n-1)/2){
cout<<"DA\n";
return 0;
}
int cnt = 0;
bool ss = 0;
for(int i = 1;i<=n;i++){
if(!vis[i]){
cnt++;
cn = 0;sum = 0;
dfs(i);
if(cn*(cn-1)/2==sum){
ss = 1;
}
}
}
if(ss&&cnt==2){
cout<<"DA\n";
}else cout<<"NE\n";
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
2644 KB |
Output is correct |
2 |
Correct |
1 ms |
2644 KB |
Output is correct |
3 |
Correct |
2 ms |
2644 KB |
Output is correct |
4 |
Correct |
2 ms |
2644 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
2652 KB |
Output is correct |
2 |
Correct |
2 ms |
2644 KB |
Output is correct |
3 |
Correct |
1 ms |
2644 KB |
Output is correct |
4 |
Correct |
2 ms |
2644 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
2644 KB |
Output is correct |
2 |
Correct |
2 ms |
2644 KB |
Output is correct |
3 |
Correct |
2 ms |
2644 KB |
Output is correct |
4 |
Correct |
2 ms |
2644 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
2644 KB |
Output is correct |
2 |
Correct |
1 ms |
2656 KB |
Output is correct |
3 |
Correct |
1 ms |
2644 KB |
Output is correct |
4 |
Correct |
2 ms |
2644 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
2644 KB |
Output is correct |
2 |
Correct |
2 ms |
2644 KB |
Output is correct |
3 |
Correct |
2 ms |
2644 KB |
Output is correct |
4 |
Correct |
2 ms |
2644 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
2644 KB |
Output is correct |
2 |
Correct |
2 ms |
2644 KB |
Output is correct |
3 |
Correct |
3 ms |
2772 KB |
Output is correct |
4 |
Correct |
3 ms |
2772 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
7 ms |
3412 KB |
Output is correct |
2 |
Correct |
48 ms |
7408 KB |
Output is correct |
3 |
Correct |
16 ms |
4356 KB |
Output is correct |
4 |
Correct |
10 ms |
3668 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
3052 KB |
Output is correct |
2 |
Correct |
25 ms |
5768 KB |
Output is correct |
3 |
Correct |
107 ms |
15224 KB |
Output is correct |
4 |
Correct |
162 ms |
21976 KB |
Output is correct |