๋ฐ์ํ ์๊ณ ๋ฆฌ์ฆ15 BOJ 5829 ) Luxury River Cruise 5829๋ฒ: Luxury River Cruise Farmer John is taking Bessie and the cows on a cruise! They are sailing on a network of rivers with N ports (1 >K; river=vector(N+2,vector (2)); int L,R; for(int i=1;i>L>>R; river[i][0]=L; river[i][1]=R; } char temp; for(int i=0;i>temp; if(temp=='L')seq.push_back(0);// L else seq.push_back(1);// R } cout 2020. 9. 22. BOJ 5980 ) Corn Maze 5980๋ฒ: Corn Maze This past fall, Farmer John took the cows to visit a corn maze. But this wasn't just any corn maze: it featured several gravity-powered teleporter slides, which cause cows to teleport instantly from one point in the maze to another. The slides work in both www.acmicpc.net ํ ๋ ํฌํธ๊ฐ ์๋ ๋ฏธ๋ก๋ฅผ ํ์ถํด์ผ ํ๋ค. BFS๋ฌธ์ ์ธ๋ฐ ํ ๋ ํฌํธ๋ฅผ ๋ฐ๋ ๊ณ์ฐ์ ๊ณ ๋ คํ๋๊ฒ ์ข ์ด๋ ค์ ๋ค. ์ผ๋จ ์ต๋จ๊ฒฝ๋ก๋ฅผ ๊ตฌํ๋ ๋ฌธ์ ๋ผ์ ๊ฐ์ ๊ธธ์ ๋๋ฒ ๊ฑฐ์น๋ฉด ๋ฌด์กฐ๊ฑด ๊ฑฐ๋ฆฌ๊ฐ ์ฆ๊ฐํด์ visited.. 2020. 9. 20. BOJ 14675 ) ๋จ์ ์ ๊ณผ ๋จ์ ์ 14675๋ฒ: ๋จ์ ์ ๊ณผ ๋จ์ ์ ํ๋ก๊ทธ๋จ์ ์ ๋ ฅ์ ํ์ค ์ ๋ ฅ์ผ๋ก ๋ฐ๋๋ค. ์ ๋ ฅ์ ์ฒซ ์ค์๋ ํธ๋ฆฌ์ ์ ์ ๊ฐ์ N์ด ์ฃผ์ด์ง๋ค. (2 ≤ N ≤ 100,000) ํธ๋ฆฌ์ ์ ์ ์ 1๋ฒ๋ถํฐ n๋ฒ๊น์ง ์กด์ฌํ๋ค. ๋ค์ ์ค๋ถํฐ N-1๊ฐ์ ์ค์ ๊ฑธ์ณ ๊ฐ์ ์ ์ www.acmicpc.net ์ฃผ์ด์ง ํธ๋ฆฌ์์ ์ฟผ๋ฆฌ๋ก ์ฃผ์ด์ง๋ ์ ์ ๊ณผ ๊ฐ์ ์ด ํด๋น ํธ๋ฆฌ์ ๋จ์ ์ ๋๋ ๋จ์ ์ ์ธ์ง(์์ ๊ฒฝ์ฐ ํธ๋ฆฌ๊ฐ ๋๋ก ๋๋๋์ง)๋ฅผ ๋ฌป๋ ๋ฌธ์ ์ด๋ค. ํํ๊ธฐ๋ง์ ์๊ณ ๋ฆฌ์ฆ ๋ฌธ์ ๋ฅผ ํ์๋๋ฐ ๋๋ฌด ์ค๋๋ง์ด๋ผ ์์ ํ ๋ฐฉํฅ์ ์๋ชป ์ก์๋ค. ๊ณ ์ง๋ณ์ธ ์๊ฐ๋ณต์ก๋ ๊ณ์ฐ ์ํ๊ณ ์ผ๋จ ๋ฌธ์ ํ๊ธฐ๋ ์ฌ์ ํ ๊ณ ์ณ์ง์ง ์์๋ค. ์ ์ ์ ๊ฐ์ 10๋ง์ ์ฟผ๋ฆฌ๊ฐ 10๋ง๊ฐ ๋ฐ ๋งค ์ฟผ๋ฆฌ๋ง๋ค dfs๋ฅผ ๋๋ ธ๊ณ ๋น์ฐํ ์๊ฐ์ด๊ณผ๊ฐ ๋ฌ๋ค. ์๊ฐํด๋ณด๋๊น ๋น์ฐํ๊ฑฐ์๋๋ฐ ์ ์งค๋๋ ๋ชจ๋ฅด๋๊ฑธ๊น. ์ฃผ์ด์ง.. 2020. 9. 19. ์ด์ 1 2 3 ๋ค์ ๋ฐ์ํ