8000 Update 5567.cpp · sms3025/basic-algo-lecture@76f2af3 · GitHub
[go: up one dir, main page]

Skip to content

Commit 76f2af3

Browse files
Update 5567.cpp
1 parent e5a0580 commit 76f2af3

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

0x18/solutions/5567.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,25 @@
11
// Authored by : yongjunleeme
22
// Co-authored by : BaaaaaaaaaaarkingDog
3-
// http://boj.kr/53b784b27d784dd2beb62f5a59ad1598
3+
// http://boj.kr/65c65de75cb34088b63463ec29b4e92a
44
#include <bits/stdc++.h>
55
using namespace std;
66

77
int n, m, a, b;
88
vector <int> adj[505];
99
int vis[505];
1010
int ans = 0;
11-
int cnt = 0;
1211

1312
void dfs(){
1413
stack<int> s;
1514
s.push(1);
1615
while(!s.empty()){
17-
if (cnt == 2) break; // 친구의 친구이니 2단계까지만 들어감
1816
int cur = s.top(); s.pop();
1917
vis[cur] = 1;
2018
for(auto nxt : adj[cur]){
2119
if(vis[nxt]) continue;
2220
vis[nxt] = 1;
2321
ans++;
24-
if(cur == 1) s.push(nxt);
22+
if(cur == 1) s.push(nxt); // 상근이의 이웃만 스택에 추가됨
2523
}
2624
}
2725
}

0 commit comments

Comments
 (0)
0