From f90d3534d0e49b8adc62f045e118522d38d9c044 Mon Sep 17 00:00:00 2001 From: lkhyun <102892446+lkhyun@users.noreply.github.com> Date: Sun, 16 Nov 2025 20:29:24 +0900 Subject: [PATCH 1/2] =?UTF-8?q?[20251116]=20BOJ=20/=20P5=20/=20=EC=B5=9C?= =?UTF-8?q?=EC=86=9F=EA=B0=92=20=EC=B0=BE=EA=B8=B0=20/=20=EC=9D=B4?= =?UTF-8?q?=EA=B0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...7\352\260\222 \354\260\276\352\270\260.md" | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 "lkhyun/202511/16 BOJ P5 \354\265\234\354\206\237\352\260\222 \354\260\276\352\270\260.md" diff --git "a/lkhyun/202511/16 BOJ P5 \354\265\234\354\206\237\352\260\222 \354\260\276\352\270\260.md" "b/lkhyun/202511/16 BOJ P5 \354\265\234\354\206\237\352\260\222 \354\260\276\352\270\260.md" new file mode 100644 index 00000000..9b52b1c7 --- /dev/null +++ "b/lkhyun/202511/16 BOJ P5 \354\265\234\354\206\237\352\260\222 \354\260\276\352\270\260.md" @@ -0,0 +1,35 @@ +```java +import java.util.*; +import java.io.*; + +public class Main { + static class Node{ + int value,idx; + Node(int value, int idx){ + this.value = value; + this.idx = idx; + } + } + static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); + static BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out)); + static StringBuilder sb = new StringBuilder(); + static StringTokenizer st; + static int N,L; + static ArrayDeque deq = new ArrayDeque<>(); + public static void main(String[] args) throws Exception { + st = new StringTokenizer(br.readLine()); + N = Integer.parseInt(st.nextToken()); + L = Integer.parseInt(st.nextToken()); + + st = new StringTokenizer(br.readLine()); + for(int i = 0; i < N; i++){ + Node cur = new Node(Integer.parseInt(st.nextToken()), i); + while(!deq.isEmpty() && deq.peekLast().value > cur.value) deq.pollLast(); + deq.offer(cur); + while(deq.peekFirst().idx < i-L+1) deq.poll(); + bw.write(deq.peekFirst().value+" "); + } + bw.close(); + } +} +``` From 00b1ed30e2a27aadaa10ed99e557d792ffff3899 Mon Sep 17 00:00:00 2001 From: lkhyun <102892446+lkhyun@users.noreply.github.com> Date: Sun, 16 Nov 2025 20:29:59 +0900 Subject: [PATCH 2/2] =?UTF-8?q?[20251116]=20BOJ=20/=20P5=20/=20=EC=B5=9C?= =?UTF-8?q?=EC=86=9F=EA=B0=92=20=EC=B0=BE=EA=B8=B0=20/=20=EC=9D=B4?= =?UTF-8?q?=EA=B0=95=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit