# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
528091 | aris12345678 | Wand (COCI19_wand) | C++14 | 30 ms | 4908 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
const int mxN = 1e5+5;
vector<int> adj[mxN];
bool vis[mxN];
void dfs(int u) {
for(auto &v : adj[u]) {
if(vis[v]) continue;
vis[v] = true;
dfs(v);
}
}
int main() {
int n, m;
scanf("%d %d", &n, &m);
for(int i = 0; i < m; i++) {
int a, b;
scanf("%d %d", &a, &b);
adj[b-1].push_back(a-1);
}
string s = "";
dfs(0);
// if(adj[0].empty())
// vis[0] = true;
for(int i = 0; i < n; i++) {
if(vis[i])
s += '1';
else
s += '0';
}
cout << s << "\n";
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |