# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
921318 | JoksimKaktus | Wand (COCI19_wand) | C++17 | 29 ms | 5716 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
void output(bool yes){yes ? cout << "Yes" << "\n" : cout << "No" << "\n";}
vector <int> adj[100005];
vector <int> res(100005);
vector <int> vis(100005);
void find(int i){
vis[i]=true;
for(int j : adj[i]){
res[j]=1;
if(vis[j])continue;
find(j);
}
vis[i]=false;
}
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(0);
int n,m;
cin >> n >> m;
for(int i = 0;i < m;i++){
int u,v;
cin >> u >> v;
u--;
v--;
adj[v].push_back(u);
}
find(0);
for(int i = 0;i < n;i++){
cout << res[i];
}
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |