From ccd1946180f33080c5e92ea87b0205dafcefd2f5 Mon Sep 17 00:00:00 2001 From: JangHongJoon Date: Wed, 27 Mar 2024 17:56:39 +0900 Subject: [PATCH 01/15] 2024.03.27 solved --- wkdghdwns199/README.md | 1 + .../ACM-24416.py" | 25 +++++++++++++++++++ .../ACM-9184.py" | 25 +++++++++++++++++++ 3 files changed, 51 insertions(+) create mode 100644 "wkdghdwns199/\353\217\231\354\240\201_\352\263\204\355\232\215\353\262\225_1/ACM-24416.py" create mode 100644 "wkdghdwns199/\353\217\231\354\240\201_\352\263\204\355\232\215\353\262\225_1/ACM-9184.py" diff --git a/wkdghdwns199/README.md b/wkdghdwns199/README.md index 60327f7..73b4d7f 100644 --- a/wkdghdwns199/README.md +++ b/wkdghdwns199/README.md @@ -17,4 +17,5 @@ | 13차시 | 2024.03.09 | DP | 정수 삼각형 | 2024.03.09 | | 14차시 | 2024.03.13 | 집합과 맵 | 영단어 암기는 괴로워 | 2024.03.13 | | 15차시 | 2024.03.20 | 우선순위 큐 | 절댓값 힙 | 2024.03.20 | +| 17차시 | 2024.03.27 | DP | 신나는 함수 실행 | 2024.03.27 | diff --git "a/wkdghdwns199/\353\217\231\354\240\201_\352\263\204\355\232\215\353\262\225_1/ACM-24416.py" "b/wkdghdwns199/\353\217\231\354\240\201_\352\263\204\355\232\215\353\262\225_1/ACM-24416.py" new file mode 100644 index 0000000..aa59f54 --- /dev/null +++ "b/wkdghdwns199/\353\217\231\354\240\201_\352\263\204\355\232\215\353\262\225_1/ACM-24416.py" @@ -0,0 +1,25 @@ +import sys +input = sys.stdin.readline + +def fib(n) : + global countFib + if n==1 or n==2: + countFib += 1 + return 1 + else : + return fib(n-1) + fib(n-2) + +def fibo(n): + global countFibo + f = [0 for _ in range(n+1)] + f[1] = f[2] = 1 + for idx in range(3, n+1): + countFibo+=1 + f[idx] = f[idx-1] + f[idx-2] + return f[n] + +N = int(input()) +countFib = countFibo = 0 +fib(N) +fibo(N) +print(countFib, countFibo) \ No newline at end of file diff --git "a/wkdghdwns199/\353\217\231\354\240\201_\352\263\204\355\232\215\353\262\225_1/ACM-9184.py" "b/wkdghdwns199/\353\217\231\354\240\201_\352\263\204\355\232\215\353\262\225_1/ACM-9184.py" new file mode 100644 index 0000000..c421a18 --- /dev/null +++ "b/wkdghdwns199/\353\217\231\354\240\201_\352\263\204\355\232\215\353\262\225_1/ACM-9184.py" @@ -0,0 +1,25 @@ +import sys +input = sys.stdin.readline + +def w(a,b,c): + if a<=0 or b<=0 or c<=0 : + return 1 + if a>20 or b>20 or c>20: + return w(20,20,20) + if dp[a][b][c] : + return dp[a][b][c] + if a Date: Mon, 1 Apr 2024 21:51:33 +0900 Subject: [PATCH 02/15] =?UTF-8?q?=EB=A6=AC=EB=B7=B0=20=ED=92=80=EC=9D=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ACM-16234.py" | 46 +++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 "wkdghdwns199/\353\246\254\353\267\260\355\222\200\354\235\264/ACM-16234.py" diff --git "a/wkdghdwns199/\353\246\254\353\267\260\355\222\200\354\235\264/ACM-16234.py" "b/wkdghdwns199/\353\246\254\353\267\260\355\222\200\354\235\264/ACM-16234.py" new file mode 100644 index 0000000..07a9c50 --- /dev/null +++ "b/wkdghdwns199/\353\246\254\353\267\260\355\222\200\354\235\264/ACM-16234.py" @@ -0,0 +1,46 @@ +import sys +from collections import deque +input = sys.stdin.readline +N,L,R = map(int, input().split()) +country = [list(map(int, input().split())) for _ in range(N)] +q = deque() +#연합이 될 수 있을지 확인 후 연랍이 되면 저장 +dx = [1,0,-1,0] +dy = [0,1,0,-1] + +def bfs(x,y): + q.append((x,y)) + union=[] + union.append((x,y)) + while q: + a,b = q.popleft() + for i in range(4): + na = a + dx[i] + nb = b + dy[i] + if na >= N or nb>= N or nb<0 or na <0 or visited[na][nb]==1: + continue + if R>=abs(country[a][b]-country[na][nb]) >= L: + visited[na][nb] = 1 + q.append((na,nb)) + union.append((na,nb)) + if len(union)<=1: + return 0 + result=sum(country[a][b] for a,b in union) // len(union) + for a,b in union: + country[a][b] = result + + return 1 +day=0 + +while True : + stop = 0 + visited = [[0]*N for _ in range(N)] + for i in range(N): + for j in range(N): + if visited[i][j] == 0: + visited[i][j] = 1 + stop += bfs(i,j) + if stop ==0: + break + day+=1 +print(day) \ No newline at end of file From 17a670ac584a9057c4dcae4e4872f56d79f87af3 Mon Sep 17 00:00:00 2001 From: JangHongJoon Date: Thu, 4 Apr 2024 21:55:54 +0900 Subject: [PATCH 03/15] README.md upload --- wkdghdwns199/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/wkdghdwns199/README.md b/wkdghdwns199/README.md index 60327f7..5328301 100644 --- a/wkdghdwns199/README.md +++ b/wkdghdwns199/README.md @@ -17,4 +17,5 @@ | 13차시 | 2024.03.09 | DP | 정수 삼각형 | 2024.03.09 | | 14차시 | 2024.03.13 | 집합과 맵 | 영단어 암기는 괴로워 | 2024.03.13 | | 15차시 | 2024.03.20 | 우선순위 큐 | 절댓값 힙 | 2024.03.20 | +| 18차시 | 2024.04.03 | 집합과 맵 | 절댓값 힙 | 2024.04.03 | From 12394e54dc3a1a721611d93d147118a108305ba9 Mon Sep 17 00:00:00 2001 From: JangHongJoon Date: Thu, 4 Apr 2024 21:56:11 +0900 Subject: [PATCH 04/15] 2024.04.03 solved --- wkdghdwns199/ACM-26069.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 wkdghdwns199/ACM-26069.py diff --git a/wkdghdwns199/ACM-26069.py b/wkdghdwns199/ACM-26069.py new file mode 100644 index 0000000..c24cfe0 --- /dev/null +++ b/wkdghdwns199/ACM-26069.py @@ -0,0 +1,25 @@ +import sys +input = sys.stdin.readline +N = int(input()) +dancingCheck = {} +dancingCheck['ChongChong'] = True +for _ in range(N): + left_rabbit, right_rabbit = map(str, input().split()) + try : + if dancingCheck[left_rabbit]: + dancingCheck[right_rabbit] = True + except : + dancingCheck[left_rabbit] = False + + try : + if dancingCheck[right_rabbit] : + dancingCheck[left_rabbit] = True + except : + dancingCheck[right_rabbit] = False + +count=0 +for key in dancingCheck.keys(): + if dancingCheck[key] == True: + count+=1 + +print(count) \ No newline at end of file From 1a26fbb7118268748bf37f2128ec94a35f4ea128 Mon Sep 17 00:00:00 2001 From: vrexpert Date: Thu, 4 Apr 2024 22:27:42 +0900 Subject: [PATCH 05/15] 2024-04-04 solved --- ...4\352\270\260_\353\260\261\354\244\200.kt" | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 "SeongHoonC/greedy/\355\201\260 \354\210\230 \353\247\214\353\223\244\352\270\260_\353\260\261\354\244\200.kt" diff --git "a/SeongHoonC/greedy/\355\201\260 \354\210\230 \353\247\214\353\223\244\352\270\260_\353\260\261\354\244\200.kt" "b/SeongHoonC/greedy/\355\201\260 \354\210\230 \353\247\214\353\223\244\352\270\260_\353\260\261\354\244\200.kt" new file mode 100644 index 0000000..5bb1d22 --- /dev/null +++ "b/SeongHoonC/greedy/\355\201\260 \354\210\230 \353\247\214\353\223\244\352\270\260_\353\260\261\354\244\200.kt" @@ -0,0 +1,28 @@ +import java.io.BufferedReader +import java.io.InputStreamReader +import java.util.PriorityQueue + +fun main() { + val br = BufferedReader(InputStreamReader(System.`in`)) + val n = br.readLine().toInt() + val numbers = br.readLine().split(" ") + val queue = PriorityQueue() + numbers.forEach { + queue.add(Target(it)) + } + val stringBuilder = StringBuilder() + while (queue.isNotEmpty()) { + stringBuilder.append(queue.poll().number) + } + if (stringBuilder.all { it == '0' }) { + println(0) + return + } + println(stringBuilder.toString()) +} + +data class Target(val number: String) : Comparable { + override fun compareTo(other: Target): Int { + return if (number + other.number > other.number + number) -1 else 1 + } +} From f12298cb69e2e4c3e55013cf41f9690e269322b2 Mon Sep 17 00:00:00 2001 From: vrexpert Date: Thu, 4 Apr 2024 22:34:38 +0900 Subject: [PATCH 06/15] 2024-04-04 solved --- SeongHoonC/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/SeongHoonC/README.md b/SeongHoonC/README.md index 7edeb92..f57435c 100644 --- a/SeongHoonC/README.md +++ b/SeongHoonC/README.md @@ -20,4 +20,5 @@ | 16차시 | 2024.03.14 | 누적합 | |https://github.com/AlgoLeadMe/AlgoLeadMe-6/pull/60 | | 17차시 | 2024.03.17 | 특정한 최단 경로 | |https://github.com/AlgoLeadMe/AlgoLeadMe-6/pull/62 | | 18차시 | 2024.03.28 | 구현 | |https://github.com/AlgoLeadMe/AlgoLeadMe-6/pull/70 | +| 19차시 | 2024.04.04 | 그리디 | |https://github.com/AlgoLeadMe/AlgoLeadMe-6/pull/72 | --- From db22a13ccc35307e73eae41b94a4a98231a8c9a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=EB=AF=BC=EC=84=9D=7CMinseok=20Kim?= Date: Sat, 6 Apr 2024 22:12:54 +0900 Subject: [PATCH 07/15] =?UTF-8?q?21=EC=B0=A8=EC=8B=9C=20=EB=AC=B8=EC=A0=9C?= =?UTF-8?q?=20=EC=84=A0=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- alstjr7437/README.md | 3 ++- .../\354\247\221\355\225\251.py" | 0 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 "alstjr7437/\353\271\204\355\212\270\353\247\210\354\212\244\355\202\271/\354\247\221\355\225\251.py" diff --git a/alstjr7437/README.md b/alstjr7437/README.md index 4b3dfca..2d02b65 100644 --- a/alstjr7437/README.md +++ b/alstjr7437/README.md @@ -17,4 +17,5 @@ | 13차시 | 2024.02.29 | DP | 쉬운 계단 수 | https://github.com/AlgoLeadMe/AlgoLeadMe-6/pull/42 | | 14차시 | 2024.03.03 | 브루트포스 | 마인크래프트 | https://github.com/AlgoLeadMe/AlgoLeadMe-6/pull/48 | | 15차시 | 2024.03.09 | 우선순위 큐 | 파일 합치기3 | https://github.com/AlgoLeadMe/AlgoLeadMe-6/pull/53 | -| 16차시 | 2024.03.13 | 정렬 | 선 긋기 | https://github.com/AlgoLeadMe/AlgoLeadMe-6/pull/57 | \ No newline at end of file +| 16차시 | 2024.03.13 | 정렬 | 선 긋기 | https://github.com/AlgoLeadMe/AlgoLeadMe-6/pull/57 | +| 21차시 | 2024.04.06 | 비트마스킹 | 집합 | https://github.com/AlgoLeadMe/AlgoLeadMe-6/pull/74 | \ No newline at end of file diff --git "a/alstjr7437/\353\271\204\355\212\270\353\247\210\354\212\244\355\202\271/\354\247\221\355\225\251.py" "b/alstjr7437/\353\271\204\355\212\270\353\247\210\354\212\244\355\202\271/\354\247\221\355\225\251.py" new file mode 100644 index 0000000..e69de29 From 15f0e987f0c855bb548c5b1a5cee215640be2012 Mon Sep 17 00:00:00 2001 From: vrexpert Date: Sun, 7 Apr 2024 01:05:19 +0900 Subject: [PATCH 08/15] 2024-04-07 solved --- "SeongHoonC/dp/\354\225\261.kt" | 34 +++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 "SeongHoonC/dp/\354\225\261.kt" diff --git "a/SeongHoonC/dp/\354\225\261.kt" "b/SeongHoonC/dp/\354\225\261.kt" new file mode 100644 index 0000000..0de0f1b --- /dev/null +++ "b/SeongHoonC/dp/\354\225\261.kt" @@ -0,0 +1,34 @@ +import java.io.BufferedReader +import java.io.InputStreamReader +import kotlin.math.max +import kotlin.math.min + +const val MAX_COST = 10_000 +fun main() { + val br = BufferedReader(InputStreamReader(System.`in`)) + val (n, m) = br.readLine().split(" ").map { it.toInt() } + + // 비용의 최대는 100 * 100 이다 + val dp = Array(n + 1) { Array(MAX_COST + 1) { 0 } } + val bites = listOf(0) + br.readLine().split(" ").map { it.toInt() } + val cost = listOf(0) + br.readLine().split(" ").map { it.toInt() } + + var minCost = Int.MAX_VALUE + for (i in 1..n) { + for (j in 0..MAX_COST) { + // 담을 수 없다면 이전에 i-1 까지 담아놓은 것 그대로 + if (j - cost[i] < 0) { + dp[i][j] = dp[i - 1][j] + continue + } + // 담을 수 있다면 현재 비용 - 앱의 비용 최적값에 얻을 수 있는 용량 더하기 + dp[i][j] = max(dp[i - 1][j], dp[i - 1][j - cost[i]] + bites[i]) + + // 목표 용량을 넘었다면 정답 최소값 업데이트 + if (dp[i][j] >= m) { + minCost = min(minCost, j) + } + } + } + println(minCost) +} From c9646d06d9b1683a8df0c74bb2ef0a99605dea93 Mon Sep 17 00:00:00 2001 From: vrexpert Date: Sun, 7 Apr 2024 01:12:36 +0900 Subject: [PATCH 09/15] 2024-04-07 update README.md --- SeongHoonC/README.md | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/SeongHoonC/README.md b/SeongHoonC/README.md index f57435c..3f56164 100644 --- a/SeongHoonC/README.md +++ b/SeongHoonC/README.md @@ -8,17 +8,18 @@ | 4차시 | 2024.01.24 | 구현 | 마법의 엘리베이터 | https://github.com/AlgoLeadMe/AlgoLeadMe-6/pull/11 | | 5차시 | 2024.01.27 | 그리디 | 광물 캐기 | https://github.com/AlgoLeadMe/AlgoLeadMe-6/pull/13 | | 6차시 | 2024.02.05 | 큐/스택 | | https://github.com/AlgoLeadMe/AlgoLeadMe-6/pull/20 | -| 7차시 | 2024.02.08 | DP | | https://github.com/AlgoLeadMe/AlgoLeadMe-6/pull/23 | -| 8차시 | 2024.02.14 | 정렬 | | https://github.com/AlgoLeadMe/AlgoLeadMe-6/pull/26 | -| 9차시 | 2024.02.21 | bfs | | https://github.com/AlgoLeadMe/AlgoLeadMe-6/pull/35 | -| 10차시 | 2024.02.23 | 그리디 | | https://github.com/AlgoLeadMe/AlgoLeadMe-6/pull/38 | -| 11차시 | 2024.02.26 | 재귀 | | https://github.com/AlgoLeadMe/AlgoLeadMe-6/pull/40 | -| 12차시 | 2024.02.29 | 분할정복 | | https://github.com/AlgoLeadMe/AlgoLeadMe-6/pull/45 | -| 13차시 | 2024.03.03 | bfs | |https://github.com/AlgoLeadMe/AlgoLeadMe-6/pull/49 | -| 14차시 | 2024.03.06 | dfs | |https://github.com/AlgoLeadMe/AlgoLeadMe-6/pull/50 | -| 15차시 | 2024.03.09 | 분할정복 | |https://github.com/AlgoLeadMe/AlgoLeadMe-6/pull/55 | -| 16차시 | 2024.03.14 | 누적합 | |https://github.com/AlgoLeadMe/AlgoLeadMe-6/pull/60 | -| 17차시 | 2024.03.17 | 특정한 최단 경로 | |https://github.com/AlgoLeadMe/AlgoLeadMe-6/pull/62 | -| 18차시 | 2024.03.28 | 구현 | |https://github.com/AlgoLeadMe/AlgoLeadMe-6/pull/70 | -| 19차시 | 2024.04.04 | 그리디 | |https://github.com/AlgoLeadMe/AlgoLeadMe-6/pull/72 | +| 7차시 | 2024.02.08 | DP | 정수 삼각형 | https://github.com/AlgoLeadMe/AlgoLeadMe-6/pull/23 | +| 8차시 | 2024.02.14 | 정렬 | 좌표 압축 | https://github.com/AlgoLeadMe/AlgoLeadMe-6/pull/26 | +| 9차시 | 2024.02.21 | bfs | 헌내기는 친구가 필요해 | https://github.com/AlgoLeadMe/AlgoLeadMe-6/pull/35 | +| 10차시 | 2024.02.23 | 그리디 | 회의실 배정 | https://github.com/AlgoLeadMe/AlgoLeadMe-6/pull/38 | +| 11차시 | 2024.02.26 | 재귀 | Z | https://github.com/AlgoLeadMe/AlgoLeadMe-6/pull/40 | +| 12차시 | 2024.02.29 | 분할정복 | 색종이 만들기 | https://github.com/AlgoLeadMe/AlgoLeadMe-6/pull/45 | +| 13차시 | 2024.03.03 | bfs | 쉬운 최단거리 |https://github.com/AlgoLeadMe/AlgoLeadMe-6/pull/49 | +| 14차시 | 2024.03.06 | dfs | 불량 사용자 |https://github.com/AlgoLeadMe/AlgoLeadMe-6/pull/50 | +| 15차시 | 2024.03.09 | 분할정복 | 곱셈 |https://github.com/AlgoLeadMe/AlgoLeadMe-6/pull/55 | +| 16차시 | 2024.03.14 | 누적합 | 구간 합 구하기 4 |https://github.com/AlgoLeadMe/AlgoLeadMe-6/pull/60 | +| 17차시 | 2024.03.17 | 다익스트라 | 특정한 최단 경로 |https://github.com/AlgoLeadMe/AlgoLeadMe-6/pull/62 | +| 18차시 | 2024.03.28 | 구현 | 인구이동 |https://github.com/AlgoLeadMe/AlgoLeadMe-6/pull/70 | +| 19차시 | 2024.04.04 | 그리디 | 큰 수 만들기 |https://github.com/AlgoLeadMe/AlgoLeadMe-6/pull/72 | +| 20차시 | 2024.04.07 | DP | |https://github.com/AlgoLeadMe/AlgoLeadMe-6/pull/75 | --- From 69fd8728c785672a53db8fb148a0725e6615c4f3 Mon Sep 17 00:00:00 2001 From: vrexpert Date: Sun, 7 Apr 2024 01:34:30 +0900 Subject: [PATCH 10/15] =?UTF-8?q?2024-04-07=20=EB=84=A4=EC=9D=B4=EB=B0=8D?= =?UTF-8?q?=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- "SeongHoonC/dp/\354\225\261.kt" | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git "a/SeongHoonC/dp/\354\225\261.kt" "b/SeongHoonC/dp/\354\225\261.kt" index 0de0f1b..6ba6df5 100644 --- "a/SeongHoonC/dp/\354\225\261.kt" +++ "b/SeongHoonC/dp/\354\225\261.kt" @@ -10,7 +10,7 @@ fun main() { // 비용의 최대는 100 * 100 이다 val dp = Array(n + 1) { Array(MAX_COST + 1) { 0 } } - val bites = listOf(0) + br.readLine().split(" ").map { it.toInt() } + val bytes = listOf(0) + br.readLine().split(" ").map { it.toInt() } val cost = listOf(0) + br.readLine().split(" ").map { it.toInt() } var minCost = Int.MAX_VALUE @@ -22,7 +22,7 @@ fun main() { continue } // 담을 수 있다면 현재 비용 - 앱의 비용 최적값에 얻을 수 있는 용량 더하기 - dp[i][j] = max(dp[i - 1][j], dp[i - 1][j - cost[i]] + bites[i]) + dp[i][j] = max(dp[i - 1][j], dp[i - 1][j - cost[i]] + bytes[i]) // 목표 용량을 넘었다면 정답 최소값 업데이트 if (dp[i][j] >= m) { From 47ea9399a4ea77d1e21b86aafc99910b7122b831 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=EB=AF=BC=EC=84=9D=7CMinseok=20Kim?= Date: Sun, 7 Apr 2024 14:23:32 +0900 Subject: [PATCH 11/15] =?UTF-8?q?21=EC=B0=A8=EC=8B=9C=20solved?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../\354\247\221\355\225\251.py" | 86 +++++++++++++++++++ 1 file changed, 86 insertions(+) diff --git "a/alstjr7437/\353\271\204\355\212\270\353\247\210\354\212\244\355\202\271/\354\247\221\355\225\251.py" "b/alstjr7437/\353\271\204\355\212\270\353\247\210\354\212\244\355\202\271/\354\247\221\355\225\251.py" index e69de29..b873f44 100644 --- "a/alstjr7437/\353\271\204\355\212\270\353\247\210\354\212\244\355\202\271/\354\247\221\355\225\251.py" +++ "b/alstjr7437/\353\271\204\355\212\270\353\247\210\354\212\244\355\202\271/\354\247\221\355\225\251.py" @@ -0,0 +1,86 @@ +import sys + +input = sys.stdin.readline + +m = int(input()) + +result = 0 + +for _ in range(m): + cmd = input().split() + print(result) + + if cmd[0] == "add": + result |= (1 << int(cmd[1])) + + if cmd[0] == "remove": + result &= ~(1 << int(cmd[1])) + + if cmd[0] == "check": + if result & (1 << int(cmd[1])): + print(1) + else: + print(0) + + if cmd[0] == "toggle": + result ^= (1 << int(cmd[1])) + + if cmd[0] == "all": + result = (1 << 21) - 1 + + if cmd[0] == "empty": + result = 0 + + +# for _ in range(m): +# cmd = input().split() + +# if cmd[0] == "add": +# result[int(cmd[1])] = 1 + +# if cmd[0] == "remove": +# result[int(cmd[1])] = 0 + +# if cmd[0] == "check": +# if result[int(cmd[1])] == 1: +# print(1) +# else : +# print(0) + +# if cmd[0] == "toggle": +# if result[int(cmd[1])] == 1: +# result[int(cmd[1])] = 0 +# else : +# result[int(cmd[1])] = 1 + +# if cmd[0] == "all": +# result = [1] * len(result) + +# if cmd[0] == "empty": +# result = [0] * len(result) + +""" +S = set() + +for _ in range(m): + temp = input().split() + + if temp[0] == "add": + S.add(int(temp[1])) + if temp[0] == "remove": + S.discard(int(temp[1])) + if temp[0] == "check": + if int(temp[1]) in S: + print(1) + else : + print(0) + if temp[0] == "toggle": + if int(temp[1]) in S: + S.discard(int(temp[1])) + else: + S.add(int(temp[1])) + if temp[0] == "all": + S = set([i for i in range(1, 21)]) + if temp[0] == "empty": + S = set() +""" \ No newline at end of file From 64dc5b5a58b7bb10d16675cff564bb6d7629c6a2 Mon Sep 17 00:00:00 2001 From: JangHongJoon Date: Mon, 8 Apr 2024 00:15:20 +0900 Subject: [PATCH 12/15] 2024.04.08 solved --- wkdghdwns199/ACM-25192.py | 19 +++++++++++++++++++ wkdghdwns199/README.md | 1 + 2 files changed, 20 insertions(+) create mode 100644 wkdghdwns199/ACM-25192.py diff --git a/wkdghdwns199/ACM-25192.py b/wkdghdwns199/ACM-25192.py new file mode 100644 index 0000000..22d787c --- /dev/null +++ b/wkdghdwns199/ACM-25192.py @@ -0,0 +1,19 @@ +import sys +input = sys.stdin.readline +N = int(input()) +emoji_using_users = set() +time_for_emoji_use = False +emoji_use_count = 0 +for _ in range(N): + chat_string = input().rstrip() + if chat_string == 'ENTER' : + if time_for_emoji_use : + emoji_use_count += len(emoji_using_users) + else : + time_for_emoji_use = True + emoji_using_users = set() + else : + emoji_using_users.add(chat_string) + +emoji_use_count+=len(emoji_using_users) +print(emoji_use_count) \ No newline at end of file diff --git a/wkdghdwns199/README.md b/wkdghdwns199/README.md index 10a813b..c033c6d 100644 --- a/wkdghdwns199/README.md +++ b/wkdghdwns199/README.md @@ -18,4 +18,5 @@ | 14차시 | 2024.03.13 | 집합과 맵 | 영단어 암기는 괴로워 | 2024.03.13 | | 15차시 | 2024.03.20 | 우선순위 큐 | 절댓값 힙 | 2024.03.20 | | 16차시 | 2024.03.23 | 조합론 | 이항 계수 1 | 2024.03.23 | +| 19차시 | 2024.04.07 | 조합론 | 인사성 밝은 곰곰이 | 2024.04.07 | From 98c22c4aef1f637a90c3cad081ea3b7f5de439f8 Mon Sep 17 00:00:00 2001 From: vrexpert Date: Thu, 11 Apr 2024 13:40:25 +0900 Subject: [PATCH 13/15] 2024-04-11 solved --- .../dp/RGB\352\261\260\353\246\254.kt" | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 "SeongHoonC/dp/RGB\352\261\260\353\246\254.kt" diff --git "a/SeongHoonC/dp/RGB\352\261\260\353\246\254.kt" "b/SeongHoonC/dp/RGB\352\261\260\353\246\254.kt" new file mode 100644 index 0000000..674543f --- /dev/null +++ "b/SeongHoonC/dp/RGB\352\261\260\353\246\254.kt" @@ -0,0 +1,27 @@ +import java.io.BufferedReader +import java.io.InputStreamReader + +const val MAX = 987_654_321 +val colors = 1..3 +fun main() { + val br = BufferedReader(InputStreamReader(System.`in`)) + val n = br.readLine().toInt() + val graph = Array(4) { Array(n + 1) { 0 } } + val dp = Array(4) { Array(n + 1) { 0 } } + for (i in 0 until n) { + val line = br.readLine().split(" ").map { it.toInt() } + for (j in 0..2) { + graph[j + 1][i + 1] = line[j] + } + } + + // 각 집마다 현재 이 색을 칠할 때 최소값을 구한다 + for (houseIndex in 1..n) { + for (colorIndex in colors) { + dp[colorIndex][houseIndex] = colors.minOf { + if (it == colorIndex) MAX else dp[it][houseIndex - 1] + graph[colorIndex][houseIndex] + } + } + } + println(colors.minOf { dp[it][n] }) +} From aa60f86ba1431a0013624a50cabec41988505f18 Mon Sep 17 00:00:00 2001 From: vrexpert Date: Thu, 11 Apr 2024 13:41:20 +0900 Subject: [PATCH 14/15] 2024-04-11 update README.md --- SeongHoonC/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/SeongHoonC/README.md b/SeongHoonC/README.md index 3f56164..bfe3752 100644 --- a/SeongHoonC/README.md +++ b/SeongHoonC/README.md @@ -22,4 +22,5 @@ | 18차시 | 2024.03.28 | 구현 | 인구이동 |https://github.com/AlgoLeadMe/AlgoLeadMe-6/pull/70 | | 19차시 | 2024.04.04 | 그리디 | 큰 수 만들기 |https://github.com/AlgoLeadMe/AlgoLeadMe-6/pull/72 | | 20차시 | 2024.04.07 | DP | |https://github.com/AlgoLeadMe/AlgoLeadMe-6/pull/75 | +| 21차시 | 2024.04.11 | DP | RGB거리 |https://github.com/AlgoLeadMe/AlgoLeadMe-6/pull/77 | --- From dbe63618136686fcf44f4b7e69ecc65e487cd9c4 Mon Sep 17 00:00:00 2001 From: Jang Hong Joon <35947667+wkdghdwns199@users.noreply.github.com> Date: Mon, 29 Apr 2024 18:09:07 +0900 Subject: [PATCH 15/15] Update README.md --- wkdghdwns199/README.md | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/wkdghdwns199/README.md b/wkdghdwns199/README.md index b9791e3..f5b6927 100644 --- a/wkdghdwns199/README.md +++ b/wkdghdwns199/README.md @@ -2,23 +2,23 @@ | 차시 | 날짜 | 문제유형 | 링크 | 풀이 | |:----:|:---------:|:----:|:-----:|:----:| -| 1차시 | 2024.01.22 | 집합과 맵 | 서로 다른 부분 문자열의 개수 | 2024.01.22 | -| 2차시 | 2024.01.24 | 집합과 맵 | 나는야 포켓몬 마스터 이다솜 | 2024.01.24 | -| 3차시 | 2024.01.28 | 약수, 배수와 소수 | 가로수 | 2024.01.28 | -| 4차시 | 2024.01.30 | 약수, 배수와 소수 | 다음 소수 | 2024.01.30 | -| 5차시 | 2024.02.14 | 약수, 배수와 소수 | 다음 소수 | 2024.02.14 | -| 6차시 | 2024.02.16 | 약수, 배수와 소수 | 창문 닫기 | 2024.02.16 | -| 7차시 | 2024.02.20 | 스택,큐,덱 | queuestack | 2024.02.20 | -| 8차시 | 2024.02.23 | 스택, 큐, 덱 | 도키도키 간식드리미 | 2024.02.23 | -| 9차시 | 2024.02.26 | 스택, 큐, 덱 | 풍선 터뜨리기 | 2024.02.26 | -| 10차시 | 2024.02.29 | 스택, 큐, 덱 | 큐 2 | 2024.02.29 | -| 11차시 | 2024.03.03 | 스택, 큐, 덱 | 요세푸스 문제 0 | 2024.03.03 | -| 12차시 | 2024.03.06 | DP | 다리 놓기 | 2024.03.06 | -| 13차시 | 2024.03.09 | DP | 정수 삼각형 | 2024.03.09 | -| 14차시 | 2024.03.13 | 집합과 맵 | 영단어 암기는 괴로워 | 2024.03.13 | -| 15차시 | 2024.03.20 | 우선순위 큐 | 절댓값 힙 | 2024.03.20 | -| 16차시 | 2024.03.23 | 조합론 | 이항 계수 1 | 2024.03.23 | -| 17차시 | 2024.03.27 | DP | 신나는 함수 실행 | 2024.03.27 | -| 18차시 | 2024.04.03 | 집합과 맵 | 절댓값 힙 | 2024.04.03 | -| 19차시 | 2024.04.07 | 조합론 | 인사성 밝은 곰곰이 | 2024.04.07 | +| 1차시 | 2024.01.22 | 집합과 맵 | 서로 다른 부분 문자열의 개수 | 2024.01.22 | +| 2차시 | 2024.01.24 | 집합과 맵 | 나는야 포켓몬 마스터 이다솜 | 2024.01.24 | +| 3차시 | 2024.01.28 | 약수, 배수와 소수 | 가로수 | 2024.01.28 | +| 4차시 | 2024.01.30 | 약수, 배수와 소수 | 다음 소수 | 2024.01.30 | +| 5차시 | 2024.02.14 | 약수, 배수와 소수 | 다음 소수 | 2024.02.14 | +| 6차시 | 2024.02.16 | 약수, 배수와 소수 | 창문 닫기 | 2024.02.16 | +| 7차시 | 2024.02.20 | 스택,큐,덱 | queuestack | 2024.02.20 | +| 8차시 | 2024.02.23 | 스택, 큐, 덱 | 도키도키 간식드리미 | 2024.02.23 | +| 9차시 | 2024.02.26 | 스택, 큐, 덱 | 풍선 터뜨리기 | 2024.02.26 | +| 10차시 | 2024.02.29 | 스택, 큐, 덱 | 큐 2 | 2024.02.29 | +| 11차시 | 2024.03.03 | 스택, 큐, 덱 | 요세푸스 문제 0 | 2024.03.03 | +| 12차시 | 2024.03.06 | DP | 다리 놓기 | 2024.03.06 | +| 13차시 | 2024.03.09 | DP | 정수 삼각형 | 2024.03.09 | +| 14차시 | 2024.03.13 | 집합과 맵 | 영단어 암기는 괴로워 | 2024.03.13 | +| 15차시 | 2024.03.20 | 우선순위 큐 | 절댓값 힙 | 2024.03.20 | +| 16차시 | 2024.03.23 | 조합론 | 이항 계수 1 | 2024.03.23 | +| 17차시 | 2024.03.27 | DP | 신나는 함수 실행 | 2024.03.27 | +| 18차시 | 2024.04.03 | 집합과 맵 | 절댓값 힙 | 2024.04.03 | +| 19차시 | 2024.04.07 | 조합론 | 인사성 밝은 곰곰이 | 2024.04.07 |