DFS
-
-
(4991) 로봇 청소기백준알고리즘 2019. 10. 1. 22:49
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 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 12..
-
텀 프로젝트백준알고리즘 2019. 9. 16. 23:06
정말 많이 틀린 DFS문제다. 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 #include #include #include using namespace std; int tc,n,ans; void go(int x, int start, int team, vector&v, vector&memb,vector&g){ if(memb[x] == start){ ans -= team; return; } else{ int y = memb[x]; if(g[y] == false)..
-
1949. [모의 SW 역량테스트] 등산로 조성SWexpertAcademy 2019. 9. 5. 21:08
정말 많이틀렸다.. 틀린이유는 딱한가지였는데... BFS할땐 기똥차게잘하면서 왜 맨날 DFS나 백트래킹할때는 시작포인트를 체킹안하는질모르겠다.. #include #include #include using namespace std; int tc,n,m; int map[10][10]; bool d[10][10]; int ans = 0; int dx[] = { 0,0,1,-1 }; int dy[] = { 1,-1,0,0 }; bool check(int x, int y, int cnt) { for (int i = 0; i = 0 && nx = 0 && ny < n) { if (d[nx]..