# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
97365 | mayhoubsaleh | Wand (COCI19_wand) | C++14 | 154 ms | 5296 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>
#define ll long long
#define pb push_back
using namespace std;
int n,m,a,b;
vector<int>v[100005];
bool ans[100005],vis[100005];
void dfs(int nod){
vis[nod]=1;
for(auto i:v[nod]){
ans[i]=1;
if(!vis[i])dfs(i);
}
}
int main(){
cin>>n>>m;
ans[1]=1;
for(int i=0;i<m;i++){
cin>>a>>b;
if(b==1)ans[1]=0;
v[b].pb(a);
}
dfs(1);
for(int i=1;i<=n;i++){
cout<<ans[i];
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |