Submission #921317

# Submission time Handle Problem Language Result Execution time Memory
921317 2024-02-03T17:06:29 Z JoksimKaktus Wand (COCI19_wand) C++17
0 / 70
22 ms 11868 KB
#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);

int 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];
    }
}

Compilation message

wand.cpp: In function 'int find(int)':
wand.cpp:19:1: warning: no return statement in function returning non-void [-Wreturn-type]
   19 | }
      | ^
# Verdict Execution time Memory Grader output
1 Runtime error 5 ms 7004 KB Execution killed with signal 6
2 Runtime error 6 ms 7004 KB Execution killed with signal 6
3 Runtime error 21 ms 11592 KB Execution killed with signal 6
4 Runtime error 20 ms 11568 KB Execution killed with signal 6
5 Runtime error 21 ms 11628 KB Execution killed with signal 6
6 Runtime error 21 ms 11868 KB Execution killed with signal 6
7 Runtime error 20 ms 11428 KB Execution killed with signal 6
8 Runtime error 21 ms 11864 KB Execution killed with signal 6
9 Runtime error 22 ms 11856 KB Execution killed with signal 6
10 Runtime error 22 ms 11868 KB Execution killed with signal 6