Submission #97210

#TimeUsernameProblemLanguageResultExecution timeMemory
97210MatesV13Wand (COCI19_wand)C++11
0 / 70
65 ms10616 KiB
#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 timeMemoryGrader output
Fetching results...