Submission #100984

#TimeUsernameProblemLanguageResultExecution timeMemory
100984KLPPWand (COCI19_wand)C++14
70 / 70
92 ms25848 KiB
#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 (stderr)

wand.cpp: In function 'void DFS(int)':
wand.cpp:9:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(int i=0;i<nei[node].size();i++){
               ~^~~~~~~~~~~~~~~~~
wand.cpp: In function 'int main()':
wand.cpp:18:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d %d",&n,&m);
   ~~~~~^~~~~~~~~~~~~~~
wand.cpp:22:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d %d",&x,&y);
     ~~~~~^~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...