# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
97210 | MatesV13 | Wand (COCI19_wand) | C++11 | 65 ms | 10616 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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... |