From 764cef54dacaf63adc4cd77c81a6debb16302135 Mon Sep 17 00:00:00 2001 From: hangyeol Date: Wed, 5 Mar 2025 22:52:51 +0900 Subject: [PATCH 1/3] =?UTF-8?q?88=EC=B0=A8=201=EB=B2=88=20=EB=AC=B8?= =?UTF-8?q?=EC=A0=9C=ED=92=80=EC=9D=B4=20(=EC=B0=B8=EA=B3=A0)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../\353\260\261\355\225\234\352\262\260.py" | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 "live8/test88/\353\254\270\354\240\2341/\353\260\261\355\225\234\352\262\260.py" diff --git "a/live8/test88/\353\254\270\354\240\2341/\353\260\261\355\225\234\352\262\260.py" "b/live8/test88/\353\254\270\354\240\2341/\353\260\261\355\225\234\352\262\260.py" new file mode 100644 index 00000000..2c43814f --- /dev/null +++ "b/live8/test88/\353\254\270\354\240\2341/\353\260\261\355\225\234\352\262\260.py" @@ -0,0 +1,20 @@ +def solution(sequence, k): + answer = [0, 0] + sum = 0 + min = 1000000000 + + left = 0 + + for right in range(len(sequence)): + sum += sequence[right] + + while sum > k and right >= left: + sum -= sequence[left] + left += 1 + + if sum == k: + if right - left < min: + min = right - left + answer = [left, right] + + return answer \ No newline at end of file From a6047c06a184613ddc78e3e9f4da164c36156406 Mon Sep 17 00:00:00 2001 From: hangyeol Date: Wed, 5 Mar 2025 22:53:09 +0900 Subject: [PATCH 2/3] =?UTF-8?q?88=EC=B0=A8=202=EB=B2=88=20=EB=AC=B8?= =?UTF-8?q?=EC=A0=9C=ED=92=80=EC=9D=B4=20(=EC=B0=B8=EA=B3=A0)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../\353\260\261\355\225\234\352\262\260.py" | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 "live8/test88/\353\254\270\354\240\2342/\353\260\261\355\225\234\352\262\260.py" diff --git "a/live8/test88/\353\254\270\354\240\2342/\353\260\261\355\225\234\352\262\260.py" "b/live8/test88/\353\254\270\354\240\2342/\353\260\261\355\225\234\352\262\260.py" new file mode 100644 index 00000000..57986ce6 --- /dev/null +++ "b/live8/test88/\353\254\270\354\240\2342/\353\260\261\355\225\234\352\262\260.py" @@ -0,0 +1,16 @@ +import sys + + +def main(): + N, M = map(int, sys.stdin.readline().split()) + + A = list(map(int, sys.stdin.readline().split())) + B = list(map(int, sys.stdin.readline().split())) + + result = sorted(A + B) + + print(' '.join(map(str, result))) + + +if __name__ == '__main__': + main() \ No newline at end of file From 43156c695df86faa3cd3eb76af3de55374a16648 Mon Sep 17 00:00:00 2001 From: hangyeol Date: Wed, 5 Mar 2025 22:53:19 +0900 Subject: [PATCH 3/3] =?UTF-8?q?88=EC=B0=A8=203=EB=B2=88=20=EB=AC=B8?= =?UTF-8?q?=EC=A0=9C=ED=92=80=EC=9D=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../\353\260\261\355\225\234\352\262\260.py" | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 "live8/test88/\353\254\270\354\240\2343/\353\260\261\355\225\234\352\262\260.py" diff --git "a/live8/test88/\353\254\270\354\240\2343/\353\260\261\355\225\234\352\262\260.py" "b/live8/test88/\353\254\270\354\240\2343/\353\260\261\355\225\234\352\262\260.py" new file mode 100644 index 00000000..985c9bf9 --- /dev/null +++ "b/live8/test88/\353\254\270\354\240\2343/\353\260\261\355\225\234\352\262\260.py" @@ -0,0 +1,12 @@ +def solution(n, lost, reserve): + + reserve_set = set(reserve) - set(lost) + lost_set = set(lost) - set(reserve) + + for i in sorted(reserve_set): + if i - 1 in lost_set: + lost_set.remove(i- 1) + elif i + 1 in lost_set: + lost_set.remove(i + 1) + + return n - len(lost_set) \ No newline at end of file