# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
100984 | 2019-03-15T16:48:16 Z | KLPP | Wand (COCI19_wand) | C++14 | 92 ms | 25848 KB |
#include<bits/stdc++.h> using namespace std; typedef long long int lld; vector<int> nei[1000000]; bool visited[1000000]; void DFS(int node){ //ut<<node<<" "; for(int i=0;i<nei[node].size();i++){ if(!visited[nei[node][i]]){ visited[nei[node][i]]=true; DFS(nei[node][i]); } } } int main(){ int n,m; scanf("%d %d",&n,&m); for(int i=0;i<m;i++){ int x,y; scanf("%d %d",&x,&y); x--;y--; nei[y].push_back(x); } DFS(0); if(nei[0].size()==0)visited[0]=true; for(int i=0;i<n;i++){ cout<<visited[i]; }cout<<endl; return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 25 ms | 23800 KB | Output is correct |
2 | Correct | 25 ms | 23808 KB | Output is correct |
3 | Correct | 71 ms | 25740 KB | Output is correct |
4 | Correct | 71 ms | 25692 KB | Output is correct |
5 | Correct | 72 ms | 25720 KB | Output is correct |
6 | Correct | 89 ms | 25848 KB | Output is correct |
7 | Correct | 76 ms | 25720 KB | Output is correct |
8 | Correct | 92 ms | 25848 KB | Output is correct |
9 | Correct | 82 ms | 25848 KB | Output is correct |
10 | Correct | 75 ms | 25848 KB | Output is correct |