From 2ee18d41e784a77af6f7470fda5dbd519ceeb2c5 Mon Sep 17 00:00:00 2001 From: JangHongJoon Date: Wed, 13 Mar 2024 20:54:15 +0900 Subject: [PATCH 1/4] =?UTF-8?q?=EB=A6=AC=EB=B7=B0=20=ED=92=80=EC=9D=B4=20?= =?UTF-8?q?=EC=BB=A4=EB=B0=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ACM-13975.py" | 17 +++++++ .../ACM-16235.py" | 49 +++++++++++++++++++ .../ACM-1629.py" | 12 +++++ 3 files changed, 78 insertions(+) create mode 100644 "wkdghdwns199/\353\246\254\353\267\260\355\222\200\354\235\264/ACM-13975.py" create mode 100644 "wkdghdwns199/\353\246\254\353\267\260\355\222\200\354\235\264/ACM-16235.py" create mode 100644 "wkdghdwns199/\353\246\254\353\267\260\355\222\200\354\235\264/ACM-1629.py" diff --git "a/wkdghdwns199/\353\246\254\353\267\260\355\222\200\354\235\264/ACM-13975.py" "b/wkdghdwns199/\353\246\254\353\267\260\355\222\200\354\235\264/ACM-13975.py" new file mode 100644 index 0000000..75d61b8 --- /dev/null +++ "b/wkdghdwns199/\353\246\254\353\267\260\355\222\200\354\235\264/ACM-13975.py" @@ -0,0 +1,17 @@ +import sys +from heapq import * +input = sys.stdin.readline +T = int(input()) +for _ in range(T): + N = int(input()) + chapters = list(map(int, input().split())) + time_list = [] + min_time=0 + for chapter in chapters : + heappush(time_list, chapter) + while len(time_list) > 1 : + temp =0 + temp += heappop(time_list) + heappop(time_list) + heappush(time_list, temp) + min_time += temp + print(min_time) \ No newline at end of file diff --git "a/wkdghdwns199/\353\246\254\353\267\260\355\222\200\354\235\264/ACM-16235.py" "b/wkdghdwns199/\353\246\254\353\267\260\355\222\200\354\235\264/ACM-16235.py" new file mode 100644 index 0000000..2b59511 --- /dev/null +++ "b/wkdghdwns199/\353\246\254\353\267\260\355\222\200\354\235\264/ACM-16235.py" @@ -0,0 +1,49 @@ +import sys +from collections import deque +input = sys.stdin.readline + +dx = [-1,-1,-1,0,0,1,1,1] +dy = [-1,0,1,-1,1,-1,0,1] + +N,M,K = map(int, input().split()) +A = [list(map(int, input().split())) for _ in range(N)] +trees = [[deque() for _ in range(N)] for _ in range(N)] + +for _ in range(M) : + x,y,z = map(int, input().split()) + trees[x-1][y-1].append(z) + +ground = [[5] * N for _ in range(N)] +for _ in range(K) : + + for i in range(N) : + for j in range(N): + trees_length = len(trees[i][j]) + for k in range(trees_length) : + if ground[i][j] >= trees[i][j][k] : + ground[i][j] -= trees[i][j][k] + trees[i][j][k] += 1 + else : + for _ in range(k,trees_length): + ground[i][j] += trees[i][j].pop() // 2 + break + + for i in range(N): + for j in range(N) : + for z in trees[i][j] : + if z % 5 == 0: + for idx in range(8): + move_x = i + dx[idx] + move_y = j + dy[idx] + if 0 <= move_x < N and 0 <= move_y < N : + trees[move_x][move_y].appendleft(1) + ground[i][j] += A[i][j] + +answer = 0 +for i in range(N) : + for j in range(N): + answer += len(trees[i][j]) +print(answer) + + + diff --git "a/wkdghdwns199/\353\246\254\353\267\260\355\222\200\354\235\264/ACM-1629.py" "b/wkdghdwns199/\353\246\254\353\267\260\355\222\200\354\235\264/ACM-1629.py" new file mode 100644 index 0000000..709ed30 --- /dev/null +++ "b/wkdghdwns199/\353\246\254\353\267\260\355\222\200\354\235\264/ACM-1629.py" @@ -0,0 +1,12 @@ +import sys +input = sys.stdin.readline + +def power(A,B,C): + if (B == 1) : return A%C + else : + temp = power(A,B//2, C) + if (B%2 == 0) : return temp * temp % C + else : return temp * temp * A % C + +A,B,C = map(int, input().split()) +print(power(A,B,C)) \ No newline at end of file From 320fa6307d26bd5d9af741b58301eef4ff29d2ee Mon Sep 17 00:00:00 2001 From: JangHongJoon Date: Wed, 13 Mar 2024 21:40:39 +0900 Subject: [PATCH 2/4] 2024.03.13 solved --- .../ACM-20902.py" | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 "wkdghdwns199/\354\247\221\355\225\251\352\263\274_\353\247\265/ACM-20902.py" diff --git "a/wkdghdwns199/\354\247\221\355\225\251\352\263\274_\353\247\265/ACM-20902.py" "b/wkdghdwns199/\354\247\221\355\225\251\352\263\274_\353\247\265/ACM-20902.py" new file mode 100644 index 0000000..02c9947 --- /dev/null +++ "b/wkdghdwns199/\354\247\221\355\225\251\352\263\274_\353\247\265/ACM-20902.py" @@ -0,0 +1,17 @@ +import sys +input = sys.stdin.readline +N,M = map(int, input().split()) +word_count = {} +for _ in range(N): + word = input().rstrip() + if len(word) >= M : + if word in word_count : + word_count[word] += 1 + else : + word_count[word] = 1 + +# print(word_count.items()) +sorted_word_list = sorted(word_count.items(), key=lambda word_info : (-word_info[1], -len(word_info[0]), word_info[0])) +# print() +for word in sorted_word_list : + print(word[0]) From 332b9983040a48f68718b4370c5e962352642917 Mon Sep 17 00:00:00 2001 From: JangHongJoon Date: Wed, 13 Mar 2024 21:40:46 +0900 Subject: [PATCH 3/4] README update --- wkdghdwns199/README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/wkdghdwns199/README.md b/wkdghdwns199/README.md index 21e7e87..561b67a 100644 --- a/wkdghdwns199/README.md +++ b/wkdghdwns199/README.md @@ -14,4 +14,5 @@ | 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 | \ No newline at end of file +| 13차시 | 2024.03.09 | DP | 정수 삼각형 | 2024.03.09 | +| 14차시 | 2024.03.13 | 집합과 맵 | 영단어 암기는 괴로워 | 2024.03.13 | \ No newline at end of file From 1c578ac02e97315dcd5b0d78bcc523928daedb92 Mon Sep 17 00:00:00 2001 From: JangHongJoon Date: Wed, 13 Mar 2024 21:52:58 +0900 Subject: [PATCH 4/4] 2024.03.13 another solve --- .../ACM-20902.py" | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git "a/wkdghdwns199/\354\247\221\355\225\251\352\263\274_\353\247\265/ACM-20902.py" "b/wkdghdwns199/\354\247\221\355\225\251\352\263\274_\353\247\265/ACM-20902.py" index 02c9947..b4ca7f1 100644 --- "a/wkdghdwns199/\354\247\221\355\225\251\352\263\274_\353\247\265/ACM-20902.py" +++ "b/wkdghdwns199/\354\247\221\355\225\251\352\263\274_\353\247\265/ACM-20902.py" @@ -6,12 +6,15 @@ word = input().rstrip() if len(word) >= M : if word in word_count : - word_count[word] += 1 + word_count[word][0] += 1 else : - word_count[word] = 1 + word_count[word] = [1,len(word)] -# print(word_count.items()) -sorted_word_list = sorted(word_count.items(), key=lambda word_info : (-word_info[1], -len(word_info[0]), word_info[0])) -# print() +print() +for key in word_count : + print (key) + +sorted_word_list = sorted(word_count, key=lambda key : (-word_count[key][0], -word_count[key][1], key)) +print() for word in sorted_word_list : - print(word[0]) + print(word)