Algorithm/BOJ
-
내려가기 - 2096Algorithm/BOJ 2020. 3. 14. 03:35
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 //2096 - 내려가기 #include using namespace std; #define INF 100000000 int N; int arr[100000][3]; int cache[2][3]; int cache2[2][3]; void init() { cin >> N; for (int i = 0; i arr[i][j]; } int dp(int x, int y) { if (y ..
-
최솟값 - 10868Algorithm/BOJ 2020. 3. 13. 20:38
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 //10868 - 최솟값 #include #include using namespace std; #define INF 1000000001 int N, M; int arr[100001]; struct SegmentTree { int n; vector tree; SegmentTree(int n) : n(n), tree(n*4+1) { init(1, n, 1); } int init(int left, int right, i..
-
최솟값과 최댓값 - 2357Algorithm/BOJ 2020. 3. 13. 20:16
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 //2357 - 최솟값과 최댓값 #include #include using namespace std; #define INF 1000000001 int N, M; int arr[100001]; struct SegmentTree { int n; vector mintree; vect..
-
퀘스트 중인 모험가 - 15816Algorithm/BOJ 2020. 3. 13. 16:28
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 #include #include #include #include using namespace std; int N, M; int aidx; int arr[20000..
-
전화번호 목록 - 5052Algorithm/BOJ 2020. 3. 12. 19:56
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 //5052 - 전화번호 목록 #include #include #include using namespace std; int N; vector arr; void init() { cin >> N; arr = vector(N); for(int i = 0; i> arr[i]; sort(arr.begin(), arr.end()); } int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int C; cin >> C; for(int tn = ..
-
최종 순위 - 3665Algorithm/BOJ 2020. 3. 12. 19:27
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 //3665 - 최종 순위 #include #include using namespace std; int N, M; int arr[501]; int idx[501]; int adj[501][501]; vector visit; void init() { cin >> N; for (int i = 1; i x >..
-
최소비용 구하기 2 - 11779Algorithm/BOJ 2020. 3. 12. 03:11
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 //11779 - 최소비용 구하기2 #include #include #include #include using namespace std; #define INF 1000000000 int N, M; vector adj; int S, E; void init() { cin >> N >> M; adj = vector(N+1); int x, y..