# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
100982 | KLPP | Wand (COCI19_wand) | C++14 | 96 ms | 26232 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>
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);
}
for(int i=0;i<n;i++){
DFS(i);
//ut<<endl;
}
for(int i=0;i<n;i++){
cout<<visited[i];
}cout<<endl;
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |