From 60ba7c2b483063d0a4fceeb1bcea8a12330cbcb9 Mon Sep 17 00:00:00 2001 From: sh0723 Date: Sun, 12 Jul 2026 17:34:57 +0900 Subject: [PATCH] =?UTF-8?q?2792=20:=20=EB=B3=B4=EC=84=9D=20=EC=83=81?= =?UTF-8?q?=EC=9E=90=20solve?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/week6/BOJ2792/BOJ2792_V1.cpp | 42 ++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 src/week6/BOJ2792/BOJ2792_V1.cpp diff --git a/src/week6/BOJ2792/BOJ2792_V1.cpp b/src/week6/BOJ2792/BOJ2792_V1.cpp new file mode 100644 index 0000000..289a57c --- /dev/null +++ b/src/week6/BOJ2792/BOJ2792_V1.cpp @@ -0,0 +1,42 @@ +#include +using namespace std; +int N,M; +int jewel[300000]; +int l=1, r, m, result = INT_MAX; +bool search(int num) { + int ret = 0; + for (int i=0; i> N >> M; + + for (int i=0; i> jewel[i]; + r = max(r, jewel[i]); + } + + while(l <= r) { + m = (l + r) / 2; + + if (search(m)) { + result = min(result, m); + r = m - 1; + } else { + l = m + 1; + } + } + + cout << result << '\n'; + + return 0; +} \ No newline at end of file