| # | Time | Username | Problem | Language | Result | Execution time | Memory | 
|---|---|---|---|---|---|---|---|
| 123217 | cvele | Wand (COCI19_wand) | C++14 | 124 ms | 4852 KiB | 
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <cstring>
#include <climits>
#include <iomanip>
#include <bitset>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <list>
#include <map>
using namespace std;
const int N = 100005;
int n, m;
bool used[N];
bool ok[N];
vector <int> adj[N];
void dfs(int u, int cnt) {
  if (cnt > 0) ok[u] = 1;
  used[u] = 1;
  for (int v : adj[u]) {
    if (!used[v] || v == 1) {
      dfs(v, min(2, cnt + 1));
    }
  }
}
int main() {
  cin >> n >> m;
  for (int i = 0; i < m; i++) {
    int x, y;
    cin >> x >> y;
    adj[y].push_back(x);
  }
  dfs(1, 0);
  if (adj[1].empty()) ok[1] = 1;
  for (int i = 1; i <= n; i++) {
    cout << ok[i];
  }
  cout << endl;
  return 0;
}
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
