inflearn logo
강의

강의

N
챌린지

챌린지

멘토링

멘토링

N
클립

클립

로드맵

로드맵

지식공유

yhm1620님의 게시글

yhm1620 yhm1620

@yhm1620

수강평 작성수
1
평균평점
5.0

게시글 1

질문&답변

선생님 안녕하세요. 다른 풀이에 대한 질문이 있습니다.

#include using namespace std; int board[10001][10001]; int n, m, s, e; int can(int w) { queue Q; vector ch(10001, 0); ch[s] = 1; Q.push(s); while(!Q.empty()) { int v = Q.front(); Q.pop(); for(int i = 1; i { if(board[v][i] >= w && ch[i] == 0) { //cout ch[i] = 1; Q.push(i); } } } return ch[e]; } int main() { ios_base::sync_with_stdio(false); freopen("input.txt", "rt", stdin); int lt = 1, rt = 1000000000, mid, res; cin >> n >> m; for(int i = 1; i { int a, b, c; cin >> a >> b >> c; board[a][b] = c; board[b][a] = c; } cin >> s >> e; while(lt { mid = (lt + rt) / 2; if(can(mid)) { //cout res = mid; lt = mid + 1; } else { //cout rt = mid - 1; } } cout return 0; }

좋아요수
0
댓글수
1
조회수
243