Notice
Recent Posts
Recent Comments
Link
목록단지번호붙이기 (1)
Be a developer
![](http://i1.daumcdn.net/thumb/C150x150/?fname=https://blog.kakaocdn.net/dn/GfqGV/btqubTFLhrb/7b5nq263aRBS5TGrW9UFc0/img.png)
그래프를 위한 vector 배열을 만들 필요가 없다. 효율적으로 풀기 위해서 visit 배열을 bool이 아니라 int 형으로 선언해서 문제에 나온 그림과 같이 번호를 넣어준다. 4방향을 check하는 것이 중요하다. sort할 때 정렬할 index를 잘 설정하자. 자세한 설명은 주석으로.. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 #include #include #include #include using namespace std; ..
알고리즘
2019. 4. 7. 17:55