# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
522685 | 2022-02-05T11:42:03 Z | maco1503 | Ronald (COCI17_ronald) | C++14 | 43 ms | 15260 KB |
#include <bits/stdc++.h> #define rpd ios_base :: sync_with_stdio(0); cin.tie(0); #define ll long long #define fs first #define sc second #define pb push_back #define mod int(1e9)+7 #define NMAX 500000 + 5 #define inf INT_MAX using namespace std; ifstream in(".in"); ofstream out(".out"); vector< int > g[NMAX]; int viz[NMAX]; int dfs(int nod,int ant){ if(ant!=-1&&g[nod].size()!= g[ant].size())return 1; int rasp=0; viz[nod]=1; for(int vecin:g[nod]){ if(vecin==ant || viz[vecin])continue; rasp= rasp|dfs(vecin,nod); dfs(vecin,nod); } return rasp; } int main() { rpd; int n,m,q; cin>>n>>m; for(int i=1;i<=m;i++) { int a,b,c; cin>>a>>b; g[a].pb(b); g[b].pb(a); } int cnt=0; for(int i=1;i<=n;i++){ if(!viz[i]){ int ans =dfs(i,-1); cnt++; if(ans)cnt+=3; } } if(cnt<=2)cout<<"DA"; else cout<<"NE"; return 0; } /* 4 4 2 1 2 10 1 3 30 2 4 20 3 4 5 3 4 */
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 7 ms | 11980 KB | Output is correct |
2 | Correct | 9 ms | 11980 KB | Output is correct |
3 | Correct | 8 ms | 11980 KB | Output is correct |
4 | Correct | 6 ms | 11980 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 8 ms | 12044 KB | Output is correct |
2 | Correct | 6 ms | 11980 KB | Output is correct |
3 | Correct | 7 ms | 12028 KB | Output is correct |
4 | Correct | 7 ms | 11980 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 7 ms | 11980 KB | Output is correct |
2 | Correct | 6 ms | 12072 KB | Output is correct |
3 | Correct | 7 ms | 11980 KB | Output is correct |
4 | Correct | 7 ms | 12064 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 7 ms | 11980 KB | Output is correct |
2 | Correct | 6 ms | 11980 KB | Output is correct |
3 | Correct | 6 ms | 11968 KB | Output is correct |
4 | Correct | 7 ms | 11980 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 7 ms | 11980 KB | Output is correct |
2 | Correct | 6 ms | 11980 KB | Output is correct |
3 | Correct | 9 ms | 11980 KB | Output is correct |
4 | Correct | 6 ms | 11980 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 7 ms | 11980 KB | Output is correct |
2 | Correct | 9 ms | 11980 KB | Output is correct |
3 | Correct | 9 ms | 12108 KB | Output is correct |
4 | Correct | 9 ms | 12108 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 8 ms | 12108 KB | Output is correct |
2 | Correct | 14 ms | 12876 KB | Output is correct |
3 | Correct | 12 ms | 12276 KB | Output is correct |
4 | Correct | 8 ms | 12236 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 7 ms | 12108 KB | Output is correct |
2 | Correct | 13 ms | 12620 KB | Output is correct |
3 | Correct | 36 ms | 14492 KB | Output is correct |
4 | Correct | 43 ms | 15260 KB | Output is correct |