From 56a3c290b9f1c6f70a1d7c9e62474d1c28105698 Mon Sep 17 00:00:00 2001 From: INSEA-99 Date: Fri, 17 Oct 2025 20:44:26 +0900 Subject: [PATCH 1/4] =?UTF-8?q?Solved:=2011279=20=EC=B5=9C=EB=8C=80=20?= =?UTF-8?q?=ED=9E=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../11279_\354\265\234\353\214\200_\355\236\231.py" | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 "INSEA-99/week06/11279_\354\265\234\353\214\200_\355\236\231.py" diff --git "a/INSEA-99/week06/11279_\354\265\234\353\214\200_\355\236\231.py" "b/INSEA-99/week06/11279_\354\265\234\353\214\200_\355\236\231.py" new file mode 100644 index 0000000..01338eb --- /dev/null +++ "b/INSEA-99/week06/11279_\354\265\234\353\214\200_\355\236\231.py" @@ -0,0 +1,13 @@ +# pypy3 +# 시간(ms) : 164 +# 공간(KB) : 10604 + +import sys +import heapq +input = sys.stdin.readline + +pq = [] +for _ in range(int(input().strip())) : + x = int(input().strip()) + if x : heapq.heappush(pq, -x) # 0이 아닌 경우 추가 + else : print(-heapq.heappop(pq) if len(pq) else 0) # 0인 경우 길이가 0이 아니면 pop, 맞다면 0 출력 \ No newline at end of file From ab4eabd4a3fc5cc348cece9b3d3a6f048baa62e5 Mon Sep 17 00:00:00 2001 From: INSEA-99 Date: Fri, 17 Oct 2025 20:47:32 +0900 Subject: [PATCH 2/4] =?UTF-8?q?Solved:=201927=20=EC=B5=9C=EC=86=8C=20?= =?UTF-8?q?=ED=9E=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../1927_\354\265\234\354\206\214_\355\236\231.py" | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 "INSEA-99/week06/1927_\354\265\234\354\206\214_\355\236\231.py" diff --git "a/INSEA-99/week06/1927_\354\265\234\354\206\214_\355\236\231.py" "b/INSEA-99/week06/1927_\354\265\234\354\206\214_\355\236\231.py" new file mode 100644 index 0000000..e26effb --- /dev/null +++ "b/INSEA-99/week06/1927_\354\265\234\354\206\214_\355\236\231.py" @@ -0,0 +1,13 @@ +# pypy3 +# 시간(ms) : 164 +# 공간(KB) : 114132 + +import sys +import heapq +input = sys.stdin.readline + +pq = [] +for _ in range(int(input().strip())) : + x = int(input().strip()) + if x : heapq.heappush(pq, x) # 0이 아닌 경우 추가 + else : print(heapq.heappop(pq) if len(pq) else 0) # 0인 경우 길이가 0이 아니면 pop, 맞다면 0 출력 \ No newline at end of file From e7ac9a1bd16f7c3f462d8b595f5daf11713ed30c Mon Sep 17 00:00:00 2001 From: INSEA-99 Date: Fri, 17 Oct 2025 20:50:57 +0900 Subject: [PATCH 3/4] =?UTF-8?q?Solved:=2011286=20=EC=A0=88=EB=8C=93?= =?UTF-8?q?=EA=B0=92=20=ED=9E=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...240\210\353\214\223\352\260\222_\355\236\231.py" | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 "INSEA-99/week06/11286_\354\240\210\353\214\223\352\260\222_\355\236\231.py" diff --git "a/INSEA-99/week06/11286_\354\240\210\353\214\223\352\260\222_\355\236\231.py" "b/INSEA-99/week06/11286_\354\240\210\353\214\223\352\260\222_\355\236\231.py" new file mode 100644 index 0000000..b134564 --- /dev/null +++ "b/INSEA-99/week06/11286_\354\240\210\353\214\223\352\260\222_\355\236\231.py" @@ -0,0 +1,13 @@ +# pypy3 +# 시간(ms) : 180 +# 공간(KB) : 115988 + +import sys +import heapq +input = sys.stdin.readline + +pq = [] +for _ in range(int(input().strip())) : + x = int(input().strip()) + if x : heapq.heappush(pq, (abs(x), x)) # 0이 아닌 경우 추가 + else : print(heapq.heappop(pq)[1] if len(pq) else 0) # 0인 경우 길이가 0이 아니면 pop, 맞다면 0 출력 \ No newline at end of file From 4e4be95ad1fb7f231f5e86c6c95793dfd307172c Mon Sep 17 00:00:00 2001 From: INSEA-99 Date: Fri, 17 Oct 2025 21:27:27 +0900 Subject: [PATCH 4/4] =?UTF-8?q?Solved:=202075=20N=EB=B2=88=EC=A7=B8=20?= =?UTF-8?q?=ED=81=B0=20=EC=88=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...\354\247\270_\355\201\260_\354\210\230.py" | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 "INSEA-99/week06/2075_N\353\262\210\354\247\270_\355\201\260_\354\210\230.py" diff --git "a/INSEA-99/week06/2075_N\353\262\210\354\247\270_\355\201\260_\354\210\230.py" "b/INSEA-99/week06/2075_N\353\262\210\354\247\270_\355\201\260_\354\210\230.py" new file mode 100644 index 0000000..2b48520 --- /dev/null +++ "b/INSEA-99/week06/2075_N\353\262\210\354\247\270_\355\201\260_\354\210\230.py" @@ -0,0 +1,21 @@ +# pypy3 +# 시간(ms) : 1028 +# 공간(KB) : 122816 +# +# 공유 : +# - int(1_000_000_000)은 약 29바이트 +# - 1500개 -> 약 0.05 MB +# - 1500*1500개 -> 약 77 MB + + +import sys +import heapq +input = sys.stdin.readline + +pq = [] +n = int(input().strip()) +for _ in range(n): + for x in list(map(int, input().strip().split())) : + if len(pq) < n : heapq.heappush(pq, x) # 리스트가 n개 이하면 추가 + else : heapq.heappush(pq, max(x, heapq.heappop(pq))) # 리스트가 n개 이상이면 리스트의 가장 작은 값보다 크다면 추가 +print(heapq.nsmallest(1, pq)[0])