Submission #97210

# Submission time Handle Problem Language Result Execution time Memory
97210 2019-02-14T12:10:20 Z MatesV13 Wand (COCI19_wand) C++11
0 / 70
65 ms 10616 KB
#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
1 Runtime error 8 ms 5376 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Runtime error 9 ms 5120 KB Execution killed with signal 11 (could be triggered by violating memory limits)
3 Runtime error 44 ms 9976 KB Execution killed with signal 11 (could be triggered by violating memory limits)
4 Runtime error 58 ms 10048 KB Execution killed with signal 11 (could be triggered by violating memory limits)
5 Runtime error 45 ms 10332 KB Execution killed with signal 11 (could be triggered by violating memory limits)
6 Runtime error 65 ms 10616 KB Execution killed with signal 11 (could be triggered by violating memory limits)
7 Runtime error 53 ms 10232 KB Execution killed with signal 11 (could be triggered by violating memory limits)
8 Runtime error 45 ms 10360 KB Execution killed with signal 11 (could be triggered by violating memory limits)
9 Runtime error 55 ms 10160 KB Execution killed with signal 11 (could be triggered by violating memory limits)
10 Runtime error 58 ms 10592 KB Execution killed with signal 11 (could be triggered by violating memory limits)