Algorithm
-
외판원 순회 - 2098Algorithm/BOJ 2020. 2. 19. 20:24
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 //2098 - 외판원 순회 #include #include using namespace std; #define INF 200000000 int N; int arr[16][16]; vector cache; void init() { cin >> N; for(int i = 0; i arr[i][j]; cache = vector(1
-
등산 - 1486Algorithm/BOJ 2020. 2. 18. 19:41
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 //1486 - 등산 #include #include using namespace std; #define INF 200000000 int N, M, T, D; vector adj, arr; int xarr[4] = {1, -1, 0, 0}; int yarr[4] = {0, 0, 1, -1}; void init() { cin >> N >> M >> T >> D; arr = vector..
-
DFS와 BFSAlgorithm/BOJ 2020. 2. 18. 17:17
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 //1260 - DFS와 BFS #include #include #include #include using namespace std; int N, M, S; vector adj; vector visit; void init() { cin >> N >> M >> S; adj = vector(N+1); visit = vector(N+1..
-
거의 최단 경로 - 5719Algorithm/BOJ 2020. 2. 18. 16:19
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 //5719 - 거의 최단 경로 #include #include #include using namespace std; #define INF 200000000 int N, M, S, D; vector adj; void init() { cin >> ..
-
특정한 최단 경로 - 1504Algorithm/BOJ 2020. 2. 18. 01:43
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 //1504 - 특정한 최단 경로 #include #include #include using namespace std; #define INF 200000000 int N, M, U, V; vector adj; void init() { cin >> N >> M; adj = vector(N+1); int x, y, r; for(int i = 0; i> x >> y >> r; adj[x].push_..
-
algospot - matchfixAlgorithm/알고스팟 2020. 2. 17. 19:15
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 //algospot - matchfix #include #include #include using namespace std; #define INF 2000000000 int N, M; vec..
-
집합 - 11723Algorithm/BOJ 2020. 2. 17. 03:41
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 //11723 - 집합 #include #include using namespace std; int N; void add(int u) { N |= (1