# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
97210 | MatesV13 | Wand (COCI19_wand) | C++11 | 65 ms | 10616 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;
long long n, m, x, y;
short int v[100000];
vector<int> d[100001];
queue<int> q;
void bfs(int x){
if(!d[x].empty())
for (vector<int>::iterator it=d[x].begin();it != d[x].end(); ++it){
if(v[*it]==0){q.push(*it); v[*it]=1;}
}
y = q.front();
q.pop();
bfs(y);
}
int main (){
ios::sync_with_stdio(0);
cin.tie(0);
cin >> n >> m;
for (int i=0;i<m;i++){
cin >> x >> y;
d[y].push_back(x);
}
bfs(1);
for (int i=0;i<m;i++) cout << v[i];
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |