From 56d66722c885944e997bc099d6b3375c611b48f4 Mon Sep 17 00:00:00 2001 From: lkhyun <102892446+lkhyun@users.noreply.github.com> Date: Wed, 18 Jun 2025 09:29:44 +0900 Subject: [PATCH] =?UTF-8?q?[20250618]=20BOJ=20/=20G2=20/=20=EA=B0=80?= =?UTF-8?q?=EC=9E=A5=20=EA=B8=B4=20=EC=A6=9D=EA=B0=80=ED=95=98=EB=8A=94=20?= =?UTF-8?q?=EB=B6=80=EB=B6=84=20=EC=88=98=EC=97=B4=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 --- ...0\353\266\204 \354\210\230\354\227\264.md" | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 "lkhyun/202506/18 BOJ G2 \352\260\200\354\236\245 \352\270\264 \354\246\235\352\260\200\355\225\230\353\212\224 \353\266\200\353\266\204 \354\210\230\354\227\264.md" diff --git "a/lkhyun/202506/18 BOJ G2 \352\260\200\354\236\245 \352\270\264 \354\246\235\352\260\200\355\225\230\353\212\224 \353\266\200\353\266\204 \354\210\230\354\227\264.md" "b/lkhyun/202506/18 BOJ G2 \352\260\200\354\236\245 \352\270\264 \354\246\235\352\260\200\355\225\230\353\212\224 \353\266\200\353\266\204 \354\210\230\354\227\264.md" new file mode 100644 index 00000000..41357efc --- /dev/null +++ "b/lkhyun/202506/18 BOJ G2 \352\260\200\354\236\245 \352\270\264 \354\246\235\352\260\200\355\225\230\353\212\224 \353\266\200\353\266\204 \354\210\230\354\227\264.md" @@ -0,0 +1,40 @@ +```java +import java.io.*; +import java.util.*; + +public class Main { + static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); + static BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out)); + static StringTokenizer st; + static int N; + static List LIS; + + public static void main(String[] args) throws IOException { + N = Integer.parseInt(br.readLine()); + LIS = new ArrayList<>(); + st = new StringTokenizer(br.readLine()); + for (int i = 0; i < N; i++) { + int cur = Integer.parseInt(st.nextToken()); + if(LIS.isEmpty() || LIS.get(LIS.size()-1) < cur){ + LIS.add(cur); + }else{ + LIS.set(binarySearch(cur),cur); + } + } + bw.write(LIS.size() + "\n"); + bw.close(); + } + public static int binarySearch(int target) { + int left = 0; int right = LIS.size() - 1; + while(left < right){ + int mid = (left + right) / 2; + if(LIS.get(mid) < target){ + left = mid + 1; + }else{ + right = mid; + } + } + return left; + } +} +```