| # | Time | Username | Problem | Language | Result | Execution time | Memory | 
|---|---|---|---|---|---|---|---|
| 227242 | DavidDamian | Wand (COCI19_wand) | C++11 | 44 ms | 5112 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;
///BFS
///Determine whether the wand can end up in hands of the wizard i
int n,m;
vector<int> adjList[100005];
int color[100005];
queue<int> Q;
void bfs(int s)
{
    Q.push(s);
    while(Q.size()){
        int u=Q.front();
        Q.pop();
        for(int v: adjList[u]){
            if(color[v]==0){
                color[v]=1;
                Q.push(v);
            }
        }
    }
}
int main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);
    cin>>n>>m;
    for(int i=0;i<m;i++){
        int a,b;
        cin>>a>>b;
        adjList[b].push_back(a);
    }
    bfs(1);
    if(adjList[1].size()==0) color[1]=1;
    for(int i=1;i<=n;i++){
        cout<<color[i];
    }
    return 0;
}
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
