# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
100525 | 2019-03-12T04:01:06 Z | Feeder | Wand (COCI19_wand) | C++11 | 71 ms | 6008 KB |
#include<bits/stdc++.h> using namespace std; bool vis[100001]; vector<int> adj[100001]; void dfs(int x){ vis[x] = 1; for(int i=0; i<adj[x].size(); i++){ if(vis[adj[x][i]]) continue; dfs(adj[x][i]); } } int main(){ ios::sync_with_stdio(0); cin.tie(0); int n, m, a, b; cin >> n >> m; for(int i=0; i<m; i++){ cin >> a >> b; adj[b].push_back(a); } for(int i=0; i<adj[1].size(); i++) dfs(adj[1][i]); for(int i=1; i<=n; i++) cout << vis[i]; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 2688 KB | Output is correct |
2 | Correct | 4 ms | 2688 KB | Output is correct |
3 | Correct | 45 ms | 5724 KB | Output is correct |
4 | Correct | 46 ms | 5624 KB | Output is correct |
5 | Correct | 57 ms | 5624 KB | Output is correct |
6 | Correct | 49 ms | 5880 KB | Output is correct |
7 | Correct | 47 ms | 5632 KB | Output is correct |
8 | Correct | 43 ms | 5752 KB | Output is correct |
9 | Incorrect | 53 ms | 5880 KB | Output isn't correct |
10 | Correct | 71 ms | 6008 KB | Output is correct |