# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
921318 |
2024-02-03T17:07:05 Z |
JoksimKaktus |
Wand (COCI19_wand) |
C++17 |
|
29 ms |
5716 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);
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 |
1 |
Correct |
1 ms |
3416 KB |
Output is correct |
2 |
Correct |
1 ms |
3420 KB |
Output is correct |
3 |
Correct |
18 ms |
5208 KB |
Output is correct |
4 |
Correct |
18 ms |
5396 KB |
Output is correct |
5 |
Correct |
19 ms |
5212 KB |
Output is correct |
6 |
Correct |
20 ms |
5464 KB |
Output is correct |
7 |
Correct |
18 ms |
5212 KB |
Output is correct |
8 |
Correct |
29 ms |
5716 KB |
Output is correct |
9 |
Incorrect |
20 ms |
5464 KB |
Output isn't correct |
10 |
Correct |
20 ms |
5468 KB |
Output is correct |