diff --git a/README.md b/README.md index eff2cb8..4250e6e 100644 --- a/README.md +++ b/README.md @@ -45,6 +45,13 @@ **πŸ§©ν•΄λ‹Ή λ ˆν¬μ§€ν† λ¦¬ μŠ€ν„°λ”” μ°Έκ°€μž** + +
+ +

+ +**πŸ†ν•΄λ‹Ή λ ˆν¬μ§€ν† λ¦¬ μŠ€ν„°λ”” 수료자** + + + + + + +
@@ -58,8 +65,13 @@ mong3125 rivkms
24-02-12 ~
24-05-11
24-02-12 ~
24-05-11
24-02-12 ~
24-05-11
24-02-12 ~
24-05-11
-

## 🀝 κ·œμΉ™ diff --git "a/YIM2UL2ET/BFS/13\354\260\250\354\213\234 - BOJ 7569.cpp" "b/YIM2UL2ET/BFS/13\354\260\250\354\213\234 - BOJ 7569.cpp" new file mode 100644 index 0000000..4db562f --- /dev/null +++ "b/YIM2UL2ET/BFS/13\354\260\250\354\213\234 - BOJ 7569.cpp" @@ -0,0 +1,50 @@ +#include +#include +#include + +struct idx {int z, y, x;}; + +int main(void) +{ + std::ios_base::sync_with_stdio(false); + std::cin.tie(NULL); + + int m, n, h, res = 0, non = 0; + std::vector offset = {{1, 0, 0}, {-1, 0, 0}, {0, 1, 0}, {0, -1, 0}, {0, 0, 1}, {0, 0, -1}}; + std::queue que[2]; + bool curQueue = false; + + std::cin >> n >> m >> h; + int box[h][m][n]; + + for (int z = 0; z < h; z++) { + for (int y = 0; y < m; y++) { + for (int x = 0; x < n; x++) { + std::cin >> box[z][y][x]; + if (box[z][y][x] == 1) que[curQueue].push({z, y, x}); + else if (box[z][y][x] == 0) non++; + } + } + } + + while (!que[curQueue].empty() && non > 0) { + while (!que[curQueue].empty()) { + int z = que[curQueue].front().z, y = que[curQueue].front().y, x = que[curQueue].front().x; + for (idx set : offset) { + int zz = z + set.z, yy = y + set.y, xx = x + set.x; + if (zz >= 0 && zz < h && yy >= 0 && yy < m && xx >= 0 && xx < n && box[zz][yy][xx] == 0) { + box[zz][yy][xx] = 1, non--; + que[!curQueue].push({zz, yy, xx}); + } + } + que[curQueue].pop(); + } + curQueue = !curQueue; + res++; + } + + if (non > 0) std::cout << -1; + else std::cout << res; + + return 0; +} \ No newline at end of file diff --git a/YIM2UL2ET/README.md b/YIM2UL2ET/README.md index 170c23b..97466af 100644 --- a/YIM2UL2ET/README.md +++ b/YIM2UL2ET/README.md @@ -13,4 +13,7 @@ | 09μ°¨μ‹œ | 2024.03.07 | μž„μ˜ 정밀도 / 큰 수 μ—°μ‚° && μž¬κ·€ | [BOJ 1914](https://www.acmicpc.net/problem/1914) | [BOJ 1914 풀이](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/29) | | 10μ°¨μ‹œ | 2024.03.10 | μŠ€νƒ | [BOJ 1406](https://www.acmicpc.net/problem/1406) | [BOJ 1406 풀이](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/31) | | 11μ°¨μ‹œ | 2024.03.18 | μŠ€νƒ | [BOJ 1918](https://www.acmicpc.net/problem/1918) | [BOJ 1918 풀이](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/36) | +| 12μ°¨μ‹œ | 2024.03.28 | λΉ„νŠΈλ§ˆμŠ€ν‚Ή | [BOJ 11723](https://www.acmicpc.net/problem/11723) | [BOJ 11723 풀이](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/39) | +| 13μ°¨μ‹œ | 2024.04.01 | BFS | [BOJ 7569](https://www.acmicpc.net/problem/7569) | [BOJ 7569 풀이](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/42) | +| 14μ°¨μ‹œ | 2024.04.04 | μš°μ„ μˆœμœ„ 큐 | [BOJ 11286](https://www.acmicpc.net/problem/11286) | [BOJ 11286 풀이](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/43) | --- diff --git "a/YIM2UL2ET/\353\271\204\355\212\270\353\247\210\354\212\244\355\202\271/12\354\260\250\354\213\234 - BOJ 11723.cpp" "b/YIM2UL2ET/\353\271\204\355\212\270\353\247\210\354\212\244\355\202\271/12\354\260\250\354\213\234 - BOJ 11723.cpp" new file mode 100644 index 0000000..c7b96fd --- /dev/null +++ "b/YIM2UL2ET/\353\271\204\355\212\270\353\247\210\354\212\244\355\202\271/12\354\260\250\354\213\234 - BOJ 11723.cpp" @@ -0,0 +1,36 @@ +#include + +int main(void) +{ + std::ios_base::sync_with_stdio(false); + std::cin.tie(NULL); + std::cout.tie(NULL); + + int n, k, bits = 0; + std::string command; + + std::cin >> n; + for (int i = 0; i < n; i++) { + std::cin >> command; + if (command == "add") { + std::cin >> k; + bits |= (1<> k; + bits &= ~(1<> k; + if (bits & (1<> k; + bits ^= (1< +#include + +void cre_heap(std::vector &heap, int key) { + int k = heap.size(); + heap.push_back(key); + while (k > 1) { + if (abs(heap[k/2]) > abs(heap[k]) || (abs(heap[k/2]) == abs(heap[k]) && heap[k/2] > heap[k])) { + std::swap(heap[k], heap[k/2]); + k /= 2; + } + else break; + } + return; +} + +void del_heap(std::vector &heap) { + int k = 1; + heap[1] = heap.back(), heap.pop_back(); + while (k * 2 <= heap.size()) { + if (k * 2 + 1 < heap.size() && (abs(heap[k*2+1]) < abs(heap[k*2]) || (abs(heap[k*2+1]) == abs(heap[k*2]) && heap[k*2+1] < heap[k*2]))) + k = k*2+1; + else k = k*2; + + if (abs(heap[k/2]) > abs(heap[k]) || (abs(heap[k/2]) == abs(heap[k]) && heap[k/2] > heap[k])) + std::swap(heap[k/2], heap[k]); + else break; + } + return; +} + +int main(void) { + std::ios_base::sync_with_stdio(false); + std::cin.tie(NULL); + std::cout.tie(NULL); + + int n, k, x; + std::vector abs_heap = {0}; + + std::cin >> n; + for (int i = 0; i < n; i++) { + std::cin >> x; + if (abs(x) > 0) cre_heap(abs_heap, x); + else if (abs_heap.size() > 1) { + std::cout << abs_heap[1] << '\n'; + del_heap(abs_heap); + } + else std::cout << 0 << '\n'; + } + +} \ No newline at end of file diff --git "a/mong3125/\354\235\264\353\266\204\355\203\220\354\203\211/BOJ1920_\354\210\230\354\260\276\352\270\260.java" "b/mong3125/\354\235\264\353\266\204\355\203\220\354\203\211/BOJ1920_\354\210\230\354\260\276\352\270\260.java" new file mode 100644 index 0000000..c3e05b2 --- /dev/null +++ "b/mong3125/\354\235\264\353\266\204\355\203\220\354\203\211/BOJ1920_\354\210\230\354\260\276\352\270\260.java" @@ -0,0 +1,44 @@ +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; +import java.util.Arrays; +import java.util.StringTokenizer; + +public class Main { + + static int[] A; + static int[] targets; + public static void main(String[] args) throws IOException { + BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); + int N = Integer.parseInt(br.readLine()); + A = new int[N]; + + StringTokenizer st = new StringTokenizer(br.readLine()); + for (int i = 0; i < A.length; i++) { + A[i] = Integer.parseInt(st.nextToken()); + } + + int M = Integer.parseInt(br.readLine()); + targets = new int[M]; + st = new StringTokenizer(br.readLine()); + for (int i = 0; i < targets.length; i++) { + targets[i] = Integer.parseInt(st.nextToken()); + } + + Arrays.sort(A); + + for (int i = 0; i < targets.length; i++) { + int now = targets[i]; + System.out.println(binary(0, A.length - 1, now) ? 1 : 0); + } + } + + public static boolean binary(int from, int to, int n) { + if (from > to) return false; + int mid = (from + to) / 2; + + if (A[mid] == n) return true; + else if (A[mid] > n) return binary(from, mid - 1, n); + else return binary(mid + 1, to, n); + } +} diff --git "a/mong3125/\354\235\264\354\247\204\355\203\220\354\203\211/BOJ1300_K\353\262\210\354\247\270\354\210\230.java" "b/mong3125/\354\235\264\354\247\204\355\203\220\354\203\211/BOJ1300_K\353\262\210\354\247\270\354\210\230.java" new file mode 100644 index 0000000..a255a9c --- /dev/null +++ "b/mong3125/\354\235\264\354\247\204\355\203\220\354\203\211/BOJ1300_K\353\262\210\354\247\270\354\210\230.java" @@ -0,0 +1,34 @@ +package 이진탐색; + +import java.util.Scanner; + +public class BOJ1300_K번째수 { + static int n; + static int k; + static int answer; + public static void main(String[] args) { + Scanner sc = new Scanner(System.in); + n = sc.nextInt(); + k = sc.nextInt(); + + index(0, k); + System.out.println(answer); + } + + public static void index(int front, int back) { + if (front > back) return; + + int mid = (front + back) / 2; + int sum = 0; + for (int i = 1; i <= n; i++) { + sum += Math.min(mid / i, n); + } + + if (sum < k) { + index(mid + 1, back); + } else { + answer = mid; + index(front, mid - 1); + } + } +} diff --git "a/mong3125/\354\235\264\354\247\204\355\203\220\354\203\211/BOJ2343_\352\270\260\355\203\200\353\240\210\354\212\250.java" "b/mong3125/\354\235\264\354\247\204\355\203\220\354\203\211/BOJ2343_\352\270\260\355\203\200\353\240\210\354\212\250.java" new file mode 100644 index 0000000..6f357e2 --- /dev/null +++ "b/mong3125/\354\235\264\354\247\204\355\203\220\354\203\211/BOJ2343_\352\270\260\355\203\200\353\240\210\354\212\250.java" @@ -0,0 +1,66 @@ +package 이진탐색; + +import java.io.BufferedReader; +import java.io.InputStreamReader; +import java.io.IOException; +import java.util.StringTokenizer; + +public class BOJ2343_κΈ°νƒ€λ ˆμŠ¨ { + + static int N; + static int M; + static int[] lectures; + public static void main(String[] args) throws IOException { + BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); + StringTokenizer st = new StringTokenizer(br.readLine()); + + N = Integer.parseInt(st.nextToken()); + M = Integer.parseInt(st.nextToken()); + + lectures = new int[N]; + st = new StringTokenizer(br.readLine()); + + int sum = 0; + int max = 0; + for(int i = 0; i < N; i++) { + lectures[i] = Integer.parseInt(st.nextToken()); + sum += lectures[i]; + max = Math.max(max, lectures[i]); + } + + // λΈ”λ£¨λ ˆμ΄μ˜ ν¬κΈ°λŠ” maxλΆ€ν„° sum 사이 일것이닀. + int result = minimumBlueray(max, sum); + + System.out.println(result); + } + + public static int minimumBlueray(int start, int end) { + if (start < end) return -1; + + int mid = (start + end) / 2; + + if (can(mid)) { + int more = minimumBlueray(start, mid - 1); + return more != -1 ? more : mid; + } + else return minimumBlueray(mid + 1, end); + } + + public static boolean can(int blueray) { + int count = M; + int i = 0; + int stack = blueray; + while (count > 0) { + while (stack - lectures[i] > 0) { + if (i == N) return true; + stack -= lectures[i]; + i++; + } + + stack = blueray; + count--; + } + + return false; + } +} diff --git a/rivkms/queue/11279.cpp b/rivkms/queue/11279.cpp new file mode 100644 index 0000000..3b1eae7 --- /dev/null +++ b/rivkms/queue/11279.cpp @@ -0,0 +1,34 @@ +#include +#include + +using namespace std; + + + +int main(){ + ios_base::sync_with_stdio(false); + cin.tie(NULL); + cout.tie(NULL); + + int n, tmp; + cin >> n; + + priority_queue q; + vector printq; + for(int i = 0; i < n; i++){ + cin >> tmp; + if(tmp == 0){ + if(q.empty()){ + cout << 0 << "\n"; + } + else{ + cout << q.top() << "\n"; + q.pop(); + } + } + else{ + q.push(tmp); + } + } + return 0; +} \ No newline at end of file