8000
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e5a0580 commit 76f2af3Copy full SHA for 76f2af3
0x18/solutions/5567.cpp
@@ -1,27 +1,25 @@
1
// Authored by : yongjunleeme
2
// Co-authored by : BaaaaaaaaaaarkingDog
3
-// http://boj.kr/53b784b27d784dd2beb62f5a59ad1598
+// http://boj.kr/65c65de75cb34088b63463ec29b4e92a
4
#include <bits/stdc++.h>
5
using namespace std;
6
7
int n, m, a, b;
8
vector <int> adj[505];
9
int vis[505];
10
int ans = 0;
11
-int cnt = 0;
12
13
void dfs(){
14
stack<int> s;
15
s.push(1);
16
while(!s.empty()){
17
- if (cnt == 2) break; // 친구의 친구이니 2단계까지만 들어감
18
int cur = s.top(); s.pop();
19
vis[cur] = 1;
20
for(auto nxt : adj[cur]){
21
if(vis[nxt]) continue;
22
vis[nxt] = 1;
23
ans++;
24
- if(cur == 1) s.push(nxt);
+ if(cur == 1) s.push(nxt); // 상근이의 이웃만 스택에 추가됨
25
}
26
27
0 commit comments